Made using hapi.js (obv) and postgres
- Plugin style architecture, simply write plugins and scale the app.
- uses async/await instead of traditional old-school callbacks
- uses winston-logger, hence transporting logs for future reference and APM integration is available!
- mainly uses 3 node environments: development, testing, production
dev, prod, test
- easy to run, hassel free.
- easy 3rd party plugin integration, simply write the plugin using standard hapi documentation and put it in the plugin folder
- based on latest hapi v17+
- hapi-swagger integration, so you don't have to worry about writing a documentation for your REST-API, its automatically generated!
- Hapi - Server side framework
- Sequelize - versatile ORM can be used for (postgres, sqlite, Microsoft SQL, mysql )
- Winston Logger - Logger mechanism
- Hapi-Swagger - documentation generating library
- StandardJS - for linting the code based on the latest ES standards
- npm install
install npx globally or locally
install gulp-cli globally (not necessary but recommended)
make sure npm and node are set to latest (recommended)
npm install
npm run fix
: fixing linting errors
npm run start
: script for running gulp. Make sure to mention the node environment using NODE_ENV
All the errors
and info
level data is logged on console and in app.log
file in dev. mode.
Minimal structural and lexical changes:
- adding a fix option under nodemon to lint the code at runtime
- ensuring that all the promises are returned and callbacks are called when necessary for the ascyn processes
- improving npm script
Libraries which might be considered for future work:
- node-schedule
Done:
- good
- winston
- sequelize
- swagger
- joi
- brypt
- jsonwebtoken
- Boom
- chai/mocha winston transport logger: log files in the database/log-files or the console.
- Jwt expiry set to +60 days. User Model
- test condition: invalid password, valid email. Response. (auth/index.js)
- fixing the import statements for config in server.js and config/index.js
- Improper error handling.
- Adding timestamp key to the error response
- logging of sensitive user-info in the app.log
The following leaks were detected:@@any-promise/REGISTRATION
global variable leak.--leaks
flag has been used to ignore the global variable leak for the time being