CRUD ops with nodejs and redis using type script.
- Install dependencies in the root folder using command
npm install
- Start the local server using command
npm run dev
- Server should start at
127.0.0.1:3000
Make sure the port is free or else go to config files and change the port variable. Enter above url in browser. The home page should show a welcome message
I created a free redis cloud account. included it here to demonstrate live usage instead of running a server in local. I will remove it after assessment
- To get list of users GET
127.0.0.1:3000/user
- To get a particular user GET
127.0.0.1:3000/user/Id
- To add a new user POST
127.0.0.1:3000/user
- To delete a user DELETE
127.0.0.1:3000/user/Id
- To update a user PUT
127.0.0.1:3000/user/Id
Check out postman collection.
Included two automated test cases in test/test.js using mocha and chai. We can add as many test cases as we want. I added only two for demo purpose
Please run npm run build first to generate dist folder
npm run build
This generates dist folder which will contain server.js which will be used to run test cases
Now run below command to run test cases
npm run test