https://github.com/geekrishabh/expressts-graphql-todo
This is a todo application for building GraphQL in Node.js using ES6 and Express with JWT Authentication & typescript with auth
https://github.com/geekrishabh/expressts-graphql-todo
authorization express-graphql express-js express-typescript graphiql graphql jwt mongodb moongose typescript
Last synced: 7 months ago
JSON representation
This is a todo application for building GraphQL in Node.js using ES6 and Express with JWT Authentication & typescript with auth
- Host: GitHub
- URL: https://github.com/geekrishabh/expressts-graphql-todo
- Owner: geekrishabh
- Created: 2019-09-25T11:58:52.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-01T14:36:04.000Z (over 4 years ago)
- Last Synced: 2025-03-19T14:43:22.060Z (7 months ago)
- Topics: authorization, express-graphql, express-js, express-typescript, graphiql, graphql, jwt, mongodb, moongose, typescript
- Language: TypeScript
- Homepage:
- Size: 22.5 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Graphql-Express-MongoDB Todo With Auth
### Overview
This is a todo application for building GraphQL in Node.js using ES6 and Express with JWT Authentication & typescript
### Getting Started
Clone the repo:
```sh
git clone git@github.com:GeekRishabh/ExpressTS-Graphql-todo.git
cd ExpressTS-Graphql-todo
```Install yarn:
```js
npm install -g yarn
```Install Mongo:
```bash
brew install mongodb
```Install dependencies:
```sh
yarn
```Set environment (vars):
```sh
cp .env.example .env
```_Note:-_ Create a `.logs` folder at the root level of project & Mongodb is running.
Start server:
```sh
# Start server
yarn start# Selectively set DEBUG env var to get logs
DEBUG=express-graphql-todo:* yarn start
```Refer [debug](https://www.npmjs.com/package/debug) to know how to selectively turn on logs.
##### Deployment
```sh
# compile to ES5
1. yarn build# upload dist/ to your server
# install production dependencies only
2. yarn --production# Use any process manager to start your services
3. pm2 start dist/index.js
```In production you need to make sure your server is always up so you should ideally use any of the process manager recommended [here](http://expressjs.com/en/advanced/pm.html).
We recommend [pm2](http://pm2.keymetrics.io/) as it has several useful features like it can be configured to auto-start your services if system is rebooted.## Docker
#### Using Docker Compose for Development
```sh
# service restarts on file change
bash bin/development.sh
```#### Building and running without Docker Compose
```bash
# To use this option you need to make sure mongodb is listening on port 27017# Build docker
docker build -t express-graphql-todo .# Run docker
docker run -p 4040:4040 express-graphql-todo
```### EndPoint
• Public Graphql Endpoint
`http://localhost:4040/graphql/public`• Protected Graphql Endpoint
_Note:_ Please download [GraphiQL](https://github.com/skevy/graphiql-app) to get the protected route working .
_Note:_ Need to pass Authorization Bearer Token in Header to access this endpoint obtained from public endpoint while Signup/Login.
`http://localhost:4040/graphql/protected`
#### List Of Queries & Mutations
• [Click Me](./LIST.md)