Organization employee-manager-projects server. This uses a simple router from scratch for node.js performance junkies :) Note that this router is not as flexible as other routers, it is mostly useful for building simple APIs that don't depend on complex middleware schemes.
- Node and MongoDB should be installed on the machine
- MongoDb service should be running so that when you start the server it can seed the database.
Information: Please refer to populateDB function in files /projects/controllers/employeeprovider.js and /projects/controllers/projectprovider.js to see the seed data of employees and projects
- Open cmd prompt and change directory to 'projects' folder
- Run command 'npm start' or 'node server.js' to launch the server
- Open browser and type url http://localhost:2048/employees
- you will be able to see the list of employees in json format
- you can run other RESTful APIs using postmon or other tools
- Open cmd prompt and CD to 'projects' folder
- Run command 'npm test' or 'node node_modules/nodeunit/bin/nodeunit test' from command prompt to launch test run
-
Employee be assigned to multiple Projects.
-
A Project can be done by multiple Employees.
-
Each Project have a Manager
-
A Manager can have one or more employees under him
-
Hashtable based routing
-
RegExp for parameter testing
-
404, set custom not found handler
- Router test cases using nodeunit
- Manual test cases from browser using 'node manualtest/server.js'
- res.body is not supported as of now(as in expressJs) as it requires enhancement of router for event res.on('data',... ).
- ProjectProvider and EmployeeProvider controllers testcases has not been covered
- It is not real-time RESTful api as it requires uses of realtime nosql db (i.e. RethinkDB, or angular FireBase which are realtime DBs). If you are using realtime DBs you just need to subscribe table(s) or its perticular field and you will get the update of it, whenever documents or any of its field gets updated.