This boilerplate uses Express, Mongoose, Bootstrap 4, Font Awesome 5, jQuery, Axios and more useful stuff. We included everything you need to start a small project from scratch.
The demo application includes a ToDo list with a mongoose model, a controller and the needed JavaScript for handling events and loading data with Axios.
The npm start
command will not only start the application, but also watch for changes of your SCSS and JavaScript files, using webpack. The nodemon package is used to automatically restart the server, if your scripts change, while it's running.
- Download the boilerplate as .zip-file.
- Extract the files and copy them to your project root.
- Run
npm install
in your terminal to get all needed packages. - Copy the .env.sample file to .env.
- Run
npm start
to start the node.js application.
If you want to run the application in development mode, where webpack is watching for changes of SCSS and JavaScript files, etc. simply run the following command:
npm run dev
.
And for production mode use:
npm start
The configuration of the basic application (environment + port) is done in the .env file.
If you need more settings, that you would like to exclude from Git, you should add them here.
If you want to use TLS for secure connections, read our Let's Encrypt page.
The routing is done in the /routes/web.js file.
Just edit it and make it fit to your needs.
The views are located in the /views/ directory and we use Pug as the default template engine.
The navigation items are red from the helpers.js file. If you don't want to use the helper file you can overwrite the navigation in the view file partials/navbar.pug.
The npm run dev command will recompile all SCSS and JavaScript files automatically using webpack, if changes are detected.
This project is available under MIT License and is free for private and commercial usage.