(Right click the button and choose "Save link as").
This script simplifies the process of initializing a new Node.js project for fellow Handlebars enjoyers. It includes about 10 Handlebars helper functions that I have used quite frequently.
The script will:
- Create standard directories typically used for a new Node server.
- Install some of the most common NPM packages.
- express
- nodemon
- dotenv
- body-parser
- path
- express-handlebars
- express-session
- express-flash
- axios
You will be prompted to choose whether to include Bootstrap and SweetAlert2 assets in your public assets directory.
After the script completes, a new folder named my-node-server_<date+time>
will be created in your project directory. You may want to rename it to something more meaningful.
- Download the script into your desired project directory.
- Make sure the script is executable:
chmod +x new-handlebars-project.sh
- Run the script:
./new-handlebars-project.sh
- Start your Node server with:
The server will run on port
node app.js
9876
. This port can be configured in your.env
file.
If the name sucks, then rename the script as you see fit.
To utilize nodemon, edit the package.json
scripts to include:
"start": "nodemon app.js"
Then start your Node.js server with:
npm start
Feel free to customize this script to better suit your needs, such as adding additional packages or improving file templates. Editing the script should be straightforward.
If you have any suggestions or contributions on how to improve this script, feel free to make suggestions or contribute.