An example Express project with the following features:
- Authentication and Session Storage via passport
- Data persistence with MongoDB using the Mongoose ODM
- Example CRUD HTTP endpoints
- Code coverage, unit tests and documentation
npm install
To install the following:
- bcrypt - Lib to help you hash passwords
- body-parser - Parses incoming request bodies
- connect-mongo - MongoDB session store for Express and Connect
- dotenv - Shim to load environment variables from .env into ENV
- express - Web application framework for Node.js
- express-session - Session middleware for express
- helmet - Secure Express apps with various HTTP headers
- locreq - Local Require - use relative paths with require for unit tests
- passport - Authentication framework for Node.js
- mongoose - Object Document Mapper (ODM) for MongoDB
- aglio - An API Blueprint renderer with theme support that outputs static HTML
- chai - Chai is a BDD / TDD assertion library
- istanbul - A Javascript code coverage tool
- mocha - Simple, flexible, fun javascript test framework for node.js
- nsp - Node security platform, check for known vulnerabilities
- sinon - Standalone test spies, stubs and mocks for JavaScript
Documentation is generated via aglio using the API Blueprint Markdown format. Generated documentation can be found in the out
directory. When the application is run in development mode (NODE_ENV="development" npm start
) the documentation will be served at http://localhost:7000/doc
.
Security and dependency vulnerability scanning is done via Node Security Project. Unit testing is performed by Mocha.
Run tests with npm test
Run code coverage reports with npm run coverage
code coverage reports can be found in the 'coverage' directory.
Configure the environmental parameters via the .env
file or config them via the command line when running.
Run the application with npm start
or with optional parameters PORT=7001 NODE_ENV=development npm start