Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucasctnh/multidb-nodebr
RESTful api with authentication and multi-databases, following the NodeBR course
https://github.com/lucasctnh/multidb-nodebr
bcryptjs hapi-swagger hapijs istanbul joi-validation jwt mochajs mongodb mongoosejs multidatabase nodebr nodebr-project nodejs pm2 postegresql sequelize
Last synced: 14 days ago
JSON representation
RESTful api with authentication and multi-databases, following the NodeBR course
- Host: GitHub
- URL: https://github.com/lucasctnh/multidb-nodebr
- Owner: lucasctnh
- Created: 2019-09-12T21:42:35.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T18:39:30.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T22:43:08.563Z (about 1 month ago)
- Topics: bcryptjs, hapi-swagger, hapijs, istanbul, joi-validation, jwt, mochajs, mongodb, mongoosejs, multidatabase, nodebr, nodebr-project, nodejs, pm2, postegresql, sequelize
- Language: JavaScript
- Homepage: https://projetomultidb-postgres.herokuapp.com
- Size: 547 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## MultiDB project
This project uses both *MongoDB* and *PostgreSQL* as database. The architecture is based on the strategy design pattern with *Mocha.js* as test environment tool and *Istanbul* for code coverage, *Hapi.js* as structure and to handle with HTTP protocols, and *Json Web Token* with *Bcrypt* for users validation. This project was made for the **NodeBR** course of *Node.js*.### Run locally
To run locally you'll have to start containers in *Docker*, to do it you can type in the following commands:
```sh
docker run --name postgres -e POSTGRES_USER=user -e POSTGRES_PASSWORD=senhauser -e POSTGRES_DB=heroes -p 5432:5432 -d postgres
docker run --name adminer -p 8080:8080 --link postgres:postgres -d adminer
docker run --name mongodb -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=senhaadmin -d mongo:4
docker run --name mongoclient -p 3000:3000 --link mongodb:mongodb -d mongoclient/mongoclient
docker exec -it mongodb mongo --host localhost -u admin -p senhaadmin --authenticationDatabase admin --eval "db.getSiblingDB('herois').createUser({user: 'user', pwd: 'senhauser', roles: [{role: 'readWrite', db: 'herois'}]})"
```With the containers up you can ``npm install`` to install all dependencies, and ``npm t`` to initalize everything, run the tests and start the server. You can also call ``npm run test:prod`` to test the production environment instead of the development one.