Giter Site home page Giter Site logo

gardenbuilder-backend's Introduction

Gardenbuilder

GraphQL API and database interface for Gardenbuilder

About

Made with Typescript, TypeORM, Postgres and GraphQL

Getting Started

Database Setup

You'll need to also set up a postgresql database. I would follow the directions here.

Alternatively, you could run postgresql locally using docker: docker run -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=gardenbuilder -p 127.0.0.1:5432:5432/tcp library/postgres

Once you have postgresql set up, follow these steps:

  • while logged in as root, make a table with the same name as your desired username. If your username is coolUser, for example, name your table coolUser
  • make a main database and a test database
  • give your user privileges to those tables with GRANT ALL PRIVILEGES ON DATABASE main TO coolUser; and GRANT ALL PRIVILEGES ON DATABASE test TO coolUser;

Environment Variable Setup

Finally, you'll need to add the following into the .env file at the root of the project:

LOCAL_DATABASE_HOST=localhost
LOCAL_DATABASE_USER=yourUserName
LOCAL_DATABASE_PASSWORD=yourPassword
JWT_HASH_KEY=key
PORT=8000

To Run

To stand up the database run docker swarm init followed by docker compose up

At project root, type npm run build then npm run start:dev. This will start the API. You'll want to open up a second terminal at root and type npm run watch so that your code changes are compiled from typescript to javascript as you save them.

Then navigate to localhost:8000/graphql. You should see the graphiQL editor and be able to write queries like

query {
  gardens {
    name
  }
}

To Run Tests

Run npm test or npm run test. Tests also automatically run each time you try to make a git commit

Contributing

To Contribute, read our Contribution Guidelines

Sources / references

Plant names from https://gist.github.com/researchranks/ffe24c33df30e64f51271ddec83b4af6

gardenbuilder-backend's People

Contributors

capndave avatar smooney avatar paytonagreen avatar ingirodr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.