shirokovroma / koa-mongoose-jwt-auth-boilerplate

Simple authorization with JWT token via passport.js and jeffijoe's koa-es7-boilerplate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Koa, Mongoose, JWT Auth Example fork from Koa Boilerplate

KoaJs Slack

This is one of many build of Koa + Mongoose + Passport.js + ES7. Thx a lot to [@Jeffijoe] and his Koa Boilerplate

Quick start

# Clone repository.
git clone git@github.com:ZabedovskiyA/koa-mongoose-jwt-auth-boilerplate.git new-project

# Go to project folder.
cd new-project

# Install dependencies
yarn
# Run in development mode 

yarn dev

Server will starts at http://localhost:5000/

Settings

  1. In `src/config` create file config.js
  2. Add your database name in dbName
  3. Database user in dbUser
  4. Database password in dbPass
  5. Database host in dbHost
  6. Database port in dbPort

npm run scripts

There are a few defined run scripts, here's a list of them with a description of what they do. To run them, simply execute npm run <script name> - e.g. npm run dev

  • start: Used by the production environment to start the app. This will run a compiled version, so you need to execute build first.
  • build: Runs the babel CLI to compile the app. Files are emitted to dist/.
  • dev: Runs the app in development mode - uses babel-node to compile on-the-fly. Also uses nodemon to automatically restart when stuff changes.
  • test: Runs tests.
  • cover: Runs tests and collects coverage.
  • lint: Lints + formats the code.

Tip: to pass additional arguments to the actual CLI's being called, do it like in this example:

For npm:

# Note the `--` before the actual arguments.
npm run test -- --debug

For yarn:

# Yarn does not need the `--` before the actual arguments.
yarn test --debug

docker-compose up scripts

For running dev:

# Note: use --build only when you want to build. Usually when you change packages.json
docker-compose up --build

Tasks

Add socket.io support

Add migrations

Add logging

License

MIT.

About

Simple authorization with JWT token via passport.js and jeffijoe's koa-es7-boilerplate

License:MIT License


Languages

Language:JavaScript 97.2%Language:Dockerfile 2.8%