Skip to content
A basic skeleton for an API using Graphql and Express.js
TypeScript
Branch: master
Clone or download
Latest commit ffc8a70 May 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app update(): users modules, products module and readme Apr 29, 2019
.gitignore first() Mar 27, 2019
README.md
package.json update(): users modules, products module and readme Apr 29, 2019
tsconfig.json update(): product structure, hello example Apr 3, 2019

README.md

Node GraphQL Tutorial

A basic skeleton for an API using Graphql and Express.js

This project was made to be used within the following article:

https://www.toptal.com/graphql/graphql-nodejs-api

First things first

Please run npm install before trying to run the program

You can run the app using npm start and the app will load on port 3000.

Structure

The source code is at app folder. As matter of examples, both users and products models have a sample file just to load some data when the server is on.

This code was made without any external database to easy it up the source code reading.

In order to create a new module, please make sure to add the new module into the app.ts.

The products and users are defined in the app.ts as

let productsService = new ProductsService();
let usersService = new UsersService();
typeDefs += productsService.configTypeDefs();
typeDefs += usersService.configTypeDefs();

productsService.configResolvers(resolvers);
usersService.configResolvers(resolvers);

The purpose of this approach is to reduce huge configuration files for typeDefs and resolvers.

You can’t perform that action at this time.