It contains various Task regarding Backend like Schema Designing, Authentication, RESTAPI, etc.
Purpose:: I currently only have a very simple server.js node app checks to see if a user already exists in our database otherwise, the user can register. It uses the MVC architecture and CRUP routes for user authentication. This should serve as a starting point for me to study and develop my own api.
- Clone or download the repo
- go to task1 directory
- run command to install all required module npm install(make sure node is installed on your machine/server)
- run nodemon server.js will start your node server.
- access http://localhost:8080
- server.js is main file when node starts, performs all necessary checks and loads the necessary modules.
- below are the code lines in server.js which call the defined user routes into server.js const userRoutes=require("./routes/user_routes") //under app folder routes the file where all user routes are defined.
- /routes/user_routes.js is file where all routes/end points are define
Task 2: Create Notes and Bookmark feature for the user with 3 input name (Title or Link, Description, Tags). Search Feature by Tags
Purpose:: At this point, I have a very basic server.js application using the MVC architecture to get user notes and bookmarks details with an authentication system (with help of passport and jwt) so that only signed-in users may publish and edit notes/bookmark after finishing all the minor aspects. Although there are still things I should take care of (such as input validation, error handling, error pages, and so on) this should work as a foundation to learn and build my own api.
If you want to take this example a step further, you could (unrelated to the architecture) to make this a robust api. However, the only restriction is your own creativity, so feel free to clone the application repository and have some fun!
- Clone or download the repo
- go to task2 directory
- run command to install all required module npm install(make sure node is installed on your machine/server)
- run nodemon server.js will start your node server.
- access http://localhost:8000
- server.js is main file when node starts, it do all checks here and load required module.
- below are the code lines in server.js where redirect to route file
const userRoutes=require("./routes/user") //under app folder routes the file where all user routes are defined.
const notesRoutes=require("./routes/note") //under app folder routes the file where all notes routes are defined.
const bookmarkRoutes=require("./routes/bookmark") //under app folder routes the file where all bookmark routes are defined. - /routes/.. is file where all routes/end points are define. and each route is calling corresponding /app/controllers.
- /models/.. has all required models and can be loaded through same as any modules loads in node.
- For the authentication purpose passport & jwt(JSON Web Token) is used below are code lines var passportjwt=require('./auth/passport_jwt') const passport=require('passport')
Bookmark Creation API Request
Notes Creation API Request
Non Registered User Cannot create Notes/Bookmark
Registered Background JWT joken Authorization
Task 3: Create API’s for User and Property Booking with fields like Property Type, Property Prize, Property Location, Image, etc. Provide Search API’s for the different types of property
Purpose:: The main aim of this task is to get every details of the user's property with images so that any user even search with one of the field the property of entered choices can be displayed and we can further advance it to recommendation according to location, prices and type of property. This task also contains the email verification and forgot email notification for further user's privacy. I have used multer for image path storing purpose.
- Clone or download the repo
- go to task2 directory
- run command to install all required module npm install(make sure node is installed on your machine/server)
- run nodemon server.js will start your node server.
- access http://localhost:3000
- server.js is main file when node starts, it do all checks here and load required module.
- below are the code lines in server.js where redirect to route file
const userRoutes=require('./routes/user') //under app folder routes the file where all user routes are defined.
const propertyRoutes=require('./routes/property') //under app folder routes the file where all property routes are defined. - The auth is done through passport and jwt var passportjwt=require('./auth/passport_jwt') const passport=require('passport')