Autoplay

Learn How To Develop a Landing Page and Collect Sales Leads using ExpressJS/NodeJS

30 high quality and free videos that teach ExpressJS, NodeJS, PostgreSQL, Bootstrap

Your First Controller

Learn what a controller is in the Model-View-Controller (MVC) pattern and develop the first one in your NodeJS App

Your first git commit

Learn what git and version control is, and make your first git commit.

Installing Nodemon

Learn how to install nodemon for your ExpressJS application. 

Create your first form on your landing page

Learn to create your first form.

Implement your first POST route

Learn how to implement an ExpressJS route doing a POST http request.

Install Postgres and Sequelize

Learn to install an SQL database on your Mac OS X

Create your first model and migration

Learn how to create your first database model using Sequelize ORM and a migration

Show a collection of leads

Learn how to show a collection of leads in a page

Implement show lead page

Learn how to display an individual sales lead

Implement edit, update lead routes

Learn how to implement edit/update leads

Implement delete lead route

Learn how to delete leads from the database.

Learn how to divide pug view files into reusable sections

Learn how to divide pug files into reusable mixins, create navbar, footer, head sections

Learn how to update landing page looks, and implement a navbar

Use bootstrap classes and html elements to make the landing page look better, add a navigation bar.

Learn how to implement user sign up and login using PassportJS - Part 1

Set up PassportJS and User model infrastructure for implementing login/signup routes.

Learn how to implement user login and sign up using PassportJS - 2

Implement login and sign up routes using everything set up in part 1.

Learn how to implement form validation and re-rendering forms with errors

Learn the simplest way to implement form validation in ExpressJS and the form re-render pattern.

Develop your first middleware in ExpressJS, and implement access control

Learn what a middleware is and implement page access control using middleware.

Installing Nodemon

Learn how to install nodemon for your ExpressJS application. 

Bahadir Balban

Buzz Founder

@learningexpressjs

Nodemon automatically restarts your application and allows you to try new changes in your ExpressJS application faster.

Installing Nodemon

npm install nodemon --save-dev

Invoking nodemon in your startup script

Replace the script section as below in your package.json:

"scripts": {
    "start": "if [[ $NODE_ENV == 'production' ]]; then node ./bin/www; else nodemon ./bin/www; fi"
  },


You Might Also Like...


Join The Discussion

Gabriel Afolabi

@gabriel

Sep 1

I am using windows os the homebrew only for Apple could you address this

Bahadir Balban

@b

May 2

Sorry, I realized that this was an OS specific shell script, in this case, Linux/Bash. Solution: Use a different command for production and developer, also use the right command for your operating system. For example: "start": "node ./bin/www", "dev:start":"nodemon ./bin/www" Then use npm run dev:start for starting the server in developer environment, and use npm run start for starting it in production. This essentially removes the OS specific if / else shell script statements, and it should now work on windows. I hope this helps.

Mar 22

I try to run it in Windows PowerShell, but getting the error: PS D:\work\NodeJS\test\myapp> npm start > myapp@0.0.0 start D:\work\NodeJS\test\myapp > if [[ $NODE_ENV == 'production' ]]; then node ./bin/www; else nodemon ./bin/www; fi $NODE_ENV was unexpected at this time. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! myapp@0.0.0 start: `if [[ $NODE_ENV == 'production' ]]; then node ./bin/www; else nodemon ./bin/www; fi` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the myapp@0.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Aashish Chhabbi

@aashish

Feb 17

I am getting this error when I run the program after making changes to the script myapp@0.0.0 start C:\Windows\System32\myapp > if [[ $NODE_ENV == 'production' ]]; then node ./bin/www; else nodemon ./bin/www; fi $NODE_ENV was unexpected at this time. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! myapp@0.0.0 start: `if [[ $NODE_ENV == 'production' ]]; then node ./bin/www; else nodemon ./bin/www; fi` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the myapp@0.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\ashis\AppData\Roaming\npm-cache\_logs\2019-02-17T21_23_56_139Z-debug.log