This repo contains a data API backend using Node.js and GraphQL for Como pedir API.
- Node.js, Yarn, TypeScript, Babel
- GraphQL.js, GraphQL.js Relay, DataLoader, Yup — GraphQL schema and API endpoint
- PostgreSQL, Knex, pg — data access and db automation (migrations, seeds)
- Node.js v10 + Yarn package manager (Actually with problems using node v13)
- PostgreSQL (can be local or remote instance
Just clone the repo, tweak .env file in the root of the project, and run yarn start:
$ git clone https://github.com/comopedir/comopedir-api comopedir-api
$ cd comopedir-api # Change current directory to the newly created one
$ yarn install # Install Node.js dependencies
$ yarn start # Launch Node.js API application. Or, yarn start --env=localThe API server must become available at http://localhost:8080/graphql.
For non-production enviroments, the endpoint will show the GraphiQL IDE interface to navigate inside API.
While the app is in development, you can use a simplified migration workflow by
creating a local copy of the database, making changes to the existing
migration files (see migrations/ folder), re-apply the
migration and run the knex commands to create or update database structure:
$ knex:migrate latest # Will run the scripts until the latest migrationTip: Use knex:migrate without parameters to see entire knex working flow
for migrations.
This project is inspired in some architectural aspects from Node.js API Starter Kit, using some code of the original project.