Skip to main content

Node employee management system


Let's do some practical thing using Node.

In this Node tutorial series we are going to build an Employee Management System.
get the complete code
$ git clone
$ cd node-ems
$ npm run devstart
navigate to http://localhost:3000

home page

employees page

Generate the project

$ express --ejs --git node-ems
$ cd node-ems
$ npm install
$ npm install nodemon --save
   update scripts: "devstart": "node ./bin/www"
$ npm run devstart
quickly check the setup: http://localhost:3000/

Let's modify the folder structure a bit.

$ mkdir server
$ mv routes/ server/
$ mv views/ server/
$ mkdir server/controllers
$ mkdir server/models

> you need to modify the app.js to pick routes, views from server folder now.

Create new employee-controller in server/controllers

Create employee routes

$ mv server/routes/users.js server/routes/employees.js

Quick test on created routes using curl

$ curl -i http://localhost:3000/employees
$ curl -i http://localhost:3000/employees/view/1
$ curl -i http://localhost:3000/employees/create
$ curl -i http://localhost:3000/employees/edit/1
$ curl -i -X POST http://localhost:3000/employees/save
$ curl -i -X POST http://localhost:3000/employees/update/1
$ curl -i -X POST http://localhost:3000/employees/delete/1