alessandrodeste / nodejs-playground

NodeJs Playground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NodeJs Playground

This is a simple scaffolding project used to test libraries.

What you can find here

Libraries

Features and implementations

  • Cors support
  • Users collection CRUD with MongoDb persistence
  • Access token in jwt to handle basic authentication
  • Refresh token to create access token

Related projects

How to use

First install and configure mongodb. If the mongodb is hosted outside (ex. mlab) is possible to configure the URI and the db name in the files /src/env/development.js

Development on localhost or other development environment (ex. c9)

# Install packages
npm install

# Install mongo collection and default user
npm run mongo

# Run application with nodemon
npm run dev

In production (ex. heroku) the environment variables to use are:

  • NODE_ENV
  • IP
  • PORT
  • DB_NAME
  • DB_URI
  • JWT_SECRET

You can find a Postman project with all the stub call exported in /test/nodejs-playground.postman_collection.json.

What I'm working on and open points

  • Server side validation of Google OAuth2 client-side authentication (tricky)
  • Tests
  • Yarn
  • Remove use of mongoose default mpromise (is deprecated)
  • how to improve token lifecycle? I don't like the current result
  • how is implemented mongoose id creation? See refresh token in signup
  • why signin debug log return 401 but the actual result is 200?
  • find a non deprecated libraries for bcrypt

Thank you

About

NodeJs Playground

License:Apache License 2.0


Languages

Language:JavaScript 100.0%