Plugin Name | npm i --save | Description | Links |
---|---|---|---|
DotEnv | dotenv | Loads .env into process.env |
NPM |
ModuleAlias | module-alias | Register aliases of directories and custom module paths in Node | NPM |
PathAlias | path-alias | Register aliases and resolves path from root of application | NPM |
UUID | uuid | Generation of RFC4122 UUIDS | NPM |
Winston | winston | Universal logging | NPM |
MomentJS | moment | Date and time library | NPM | WebSite |
MomentJS Timezone | moment-timezone | Timezone library | NPM | WebSite |
CryptoJS | crypto-js | Crypto library | NPM |
Object Mapper | object-mapper | JSON object mapper | NPM |
Request | request | HTTP request library | NPM |
Request Promise | request-promise | Promise add-on to Request | NPM |
Joi | joi | JSON schema validator | NPM |
Schema Object | schema-object | JSON schema definition | NPM |
Loadash | loadash | Miscs JS library | NPM | WebSite |
Split | split | String split library | NPM |
ExpressJS | express | WebAPI library | NPM | WebSite |
CORS | cors | Cross-origin resource sharing library | NPM |
Morgan | morgan | ExpressJS logging facility | NPM |
Cookie Parser | cookie-parser | Cookie parser | NPM |
JWT | jsonwebtoken | JWT library | NPM |
EJS | ejs | JS template library | NPM |
Plugin Name | npm i --savedev | Description | Links |
---|---|---|---|
Nodemon | nodemon | NodeJS - watch and auto-restart node app | NPM | WebSite |
MochaJS | mocha | JS test framework | NPM | WebSite |
Expect.JS | expect.js | Minimalistic BDD assertion toolkit based on should.js | NPM |
SuperAgent | superagent | SuperAgent is a small progressive client-side and Node.js HTTP request library | NPM |
Read Last Line | read-last-line | Read last line(s) of a file | NPM |
- Get MASTER archive
https://github.com/azmizar/boilerplate-nodejsexpress-webapi/archive/master.zip
- Unzip to a new project folder
- If project folder is not yet set to a GIT repo
- Go into the project folder using CMD, GIT BASH, or Powershell
git init
to initialize GIT local repogit add .
to stage all filesgit commit -m "Initialized from boilerplate"
to commit all filesgit remote add origin $remote_repo$
to set the PUSH and FETCH remote repogit pull
to get remote repo branch (will see error with tracking information)git branch --set-upstream-to=origin/master master
to track current branch to remotegit push -f
to force update remote repo
- If project folder is already a GIT repo, then just commit the changes
common
contains shared scripts, modules, classes, services, etc for the entire app to usecommon-models
contains shared models for entire app to usecommon-error-messages
contains error message definitions for entire appcommon-examples
contains simple examplesconfig
contains configuration files and servicesdocs
contains documentationlogs
is the default logs folder (can be modified in .ENV)middlewares
contains shared Express middlewarespublic
contains static files
- Endpoints should be bundled as modules
- Take an example of API to manipulate file systems
- 2 modules, paths and files to work on paths and files respectively
- Folder name for app module is recommended to be prefix with
app-
- Ex:
app-paths
andapp-files
- Ex:
- All module related files should be contained within the module folder
- Anything that need to be shared should be in
common-
folder or incommon
folder if it is shared for entire app