Skip to content

🍃 A basic project for an ES6 RESTful Express server with JWT, Passport and Mongoose.

License

Notifications You must be signed in to change notification settings

emersonlaurentino/express-es6-jwt-mongoose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A basic project for an ES6 RESTful Express server with JWT, Passport and Mongoose.

Build Status

Get started

# 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

docker run --name mongo-example -v /docker/mongo-example/datadir:/data/db -p 27017:27017 -d mongo --auth

Create user on mongo

# 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

# 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   

About

🍃 A basic project for an ES6 RESTful Express server with JWT, Passport and Mongoose.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published