It is a full fledged π setup using Node.js, Express (Typescript, express-graphql), GraphQL Modules with other utilities. Graphql Modules give you enterprise grade tooling π for seperation of concern under an application with DI(dependency injection, services, middlewars and more π). The graphql modules application outputs a single schema for the GraphqlHTTP (express-graphql or apollo server).
- π Registration
- π Login & Authentication
- π Authorization
- π Additional features like winston logger setup, codegen, tsconfig, API docs generation and HMR with ts-node, nodemon, cors with node.js server setup, and ws inspection for graphql
- Node.js 16+ latest ATM(at the moment)
- Express 4+ latest ATM
- GraphQL Modules 1.4+ latest ATM
- TypeScript 4.4+ latest ATM
Yarn Yarn is used to manage API server dependencies, so we're going to need that. You can install it using Homebrew (or any of the other methods mentioned in the install docs):
After cloning go to the directory & then install the dependencies
yarn install
Create your own local .env
file in the top-level directory. Make sure it's formatted like sample.env
with the right credentials. T
Run in development mode
yarn dev
Run in development mode with node inspect
yarn dev-debug
Run in production mode
yarn prod
Goto localhost://http://localhost:4000/graphql after yarn dev
Run a mutation to register user and create JWT token (in HelloWorld it maintains a server side array instead of DB π ),
mutation register($input: Register!) {
register(input: $input) {
email,
name,
token,
id
}
}
// variables
{
"input": {"name": "Hello", "email": "[email protected]", "password": "123"}
}
Login with this mutation
mutation login($input: Login){
login(input: $input){
id,
name,
email
}
}
// variables
{
"input": {"email": "[email protected]", "password": "123"}
}
WIP