A basic scaffold/skeleton to create a Node.JS Express server.
If you wish to contribute to this repository, please feel free to clone/fork. Issue Pull Requests or open issues for any changes that you make.
- HTTP(S) Request Logging
- Rotating log system
- Enforcement of HTTPS usage in production environments
- Compression of responses
- Configurable application variables
- REST-ful API setup
- MongoDB support
All future functionality will branch off of master; the master branch will always be a simple "scaffold" express server. The other branches will contain additional functionality.
- SQL DB support: Connect and interact with SQL DB's through Sequelize
- Passport: Implement authentication and authorization strategies with Passport
-
Simply clone the repo
git clone https://github.com/Parasin/bare-express.git
-
Install the dependencies
- Install Node.JS
- Install application dependencies
npm install
-
Add the routes you need under the
routes
directory, and include require them in yourroutes/index.js
file.
| routes/
| index.js
|
|---> user/
|---> index.js
|
|---> auth/
|---> index.js
//FILE: routes/index.js
const user = require( './user' );
// WON'T ENFORCE HTTPS
if ( config.env === 'development' ) {
app.use( '/user', user );
}
// WILL ENFORCE HTTPS
else {
app.use( '/user', user );
}
- Run the command
npm test
to run the application in "development" mode. - Run the command
npm start
to run the application in "production" mode.