A simple server to handle login data of users. Handles CRUD requests, gives response to id, filter(on the basis of branch) queries and prevents duplicacy in the database (on the basis of uniqueness of roll nos.).
I have used Nodejs for server side and Mongodb as the database and express to manage routes. All the api testing is done in Postman.
index.js contains code for connecting to mongodb (i have used mongoose) and host the server at localhost:3000
model.js under models folder contains our schema --> { "name": , "rollnumber":, "branch": ", "userid": }
the server can be started using 'npm start' with all the necessary preq. installed.
routes.js---> contains all the queries-- {{http://localhost:3000/api/}} GET- /getAll- gets all the enteries in the database /getOne/:id-gets the entry by using id (id generated by the database) /filterbybranch/:br-- replace br with the branch code (for eg. EE,CSE,ES) to get filtered enteries by branch PATCH- /update/:id -- Updates data using entry id as a parameter DELETE-- delete/:id-- Deletes data using entry id as a parameter POST-- /post-- accepts json to create a new entry, some if conditions have been added to ensure that unique rollnumber enteries as two peeps cannot share same one. prints "{$rollnumber} Already exists" if existing roll no. is posted.
filter by branch:: Get ALL:: GET by id: post:: UPDATE::