Skip to content

dhruv0x0x0/backendtask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

backendtask

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.

Screenshot 2022-08-17 at 1 16 53 AM

filter by branch::

Screenshot 2022-08-17 at 1 17 30 AM

Get ALL::

Screenshot 2022-08-17 at 1 18 56 AM

GET by id:

Screenshot 2022-08-17 at 1 19 46 AM

post::

Screenshot 2022-08-17 at 1 20 34 AM

Screenshot 2022-08-17 at 1 21 01 AM

UPDATE::

Screenshot 2022-08-17 at 1 22 06 AM

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published