Skip to content

yasserhussain1110/koa-graphql-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Koa, GraphQL App

Checklist

  • Create a simple model on mongoose
  • Create a REST CRUD (create, read, update, delete) for the model created using koajs
  • it should be open sourced on your github repo

Extras

  • Create a GraphQL Type for the model created, and expose it in a GraphQL endpoint
  • Add tests using Jest
  • Add authentication
  • Add docker support

Prerequisites

  • Node >= 7.7.3
  • MongoDB >= 3.2.12

Getting Started

  • Clone this repo - git clone git@github.com:yasserhussain1110/koa-graphql-app.git
  • cd into cloned repo
  • Copy sample .env file - cp sample.env .env
  • Fill in .env values
  • Install npm dependencies - npm i
  • Start mongodb server
  • Seed the database - npm run seed
  • Start server - npm run start
  • (Optional) Test application - npm run test

Details

Models

  • Employee - This model created using Mongoose is manipulated using the Project's Rest API and GraphQL.

  • Admin - Admin model is used for authenticating requests.

Routes

  • REST - Requests can be sent to update/fetch data via ordinary REST API.
  • GraphQL - Requests can be sent to update/fetch data via GraphQL.

Tests

This project used Facebook's Jest Framework for testing purposes.
Tests cover both REST API and GraphQL endpoints.