Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emersonlaurentino/express-es6-jwt-mongoose
:leaves: A basic project for an ES6 RESTful Express server with JWT, Passport and Mongoose.
https://github.com/emersonlaurentino/express-es6-jwt-mongoose
express jwt mongoose nodejs passport restful-api
Last synced: 17 days ago
JSON representation
:leaves: A basic project for an ES6 RESTful Express server with JWT, Passport and Mongoose.
- Host: GitHub
- URL: https://github.com/emersonlaurentino/express-es6-jwt-mongoose
- Owner: emersonlaurentino
- License: mit
- Created: 2017-08-24T17:12:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-05T15:48:32.000Z (over 6 years ago)
- Last Synced: 2024-10-11T13:41:36.949Z (about 1 month ago)
- Topics: express, jwt, mongoose, nodejs, passport, restful-api
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 21
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A basic project for an ES6 RESTful Express server with JWT, Passport and Mongoose.
==================================
[![Build Status](https://travis-ci.org/emersonlaurentino/express-es6-jwt-mongoose.svg?branch=master)](https://travis-ci.org/emersonlaurentino/express-es6-jwt-mongoose)Get started
---------------
```sh
# clone it
git clone [email protected]:emersonlaurentino/express-es6-jwt-mongoose.git
cd express-es6-jwt-mongoose# Make it your own
rm -rf .git && git init# install dependences
npm i# Start development live-reload server
PORT=4000 npm run dev# Start production server:
PORT=4000 npm start
```Install mongo
---------------
```sh
docker run --name mongo-example -v /docker/mongo-example/datadir:/data/db -p 27017:27017 -d mongo --auth
```Create user on mongo
---------------
```sh
# shell of mongo on docker
docker exec -it mongo-example mongo admin# create superuser
db.createUser({ user: 'admin', pwd: '4dm1nP4ssw0rd', roles: [{ role: 'userAdminAnyDatabase', db: 'admin' }] });# auth connect
db.auth('admin', '4dm1nP4ssw0rd')# connect on new database
use example# create user with role of read and write
db.createUser({ user: 'userexample', pwd: 'us3rP4ssw0rd', roles: [{ role: 'readWrite', db: 'example' }] });
```Docker Support
---------------
```sh# Build your docker
docker build -t es6/api-service .
# ^ ^ ^
# tag tag name Dockerfile location# run your docker
docker run -p 4000:4000 es6/api-service
# ^ ^
# bind the port container tag
# to your host
# machine port
```