Backend: Sign -up, in, and out

Backend: Sign -up, in, and out

Written by Arthur Schilling | Published a year ago

So far, the frontend is pretty much completed, and I have started with the backend, creating a database, and creating routes, middleware and controller functions to sign up, in and out users of my app.

A few things:


  • body-parser and cookie-parser: Helps us work with json data between the server and the client. We install and use them as middlewar (server.js)
  • Morgan: helps us see the endpoints of our requests in the terminal. Nothing super crucial but helpful
  • nodemon: continuously run node without restarting the server
  • dotenv lets us access our environment variables of the .env file
  • cors: lets us avoid cross origin resourse sharing errors (CORS)

  • express-validator: Helps us write middleware to validate the input data of a form for example or even in postman. These middleware functions are in the validators folder and validate signup, as well as signin requests, before using the runValidation, which then let's us run our main middleware
  • express-jwt and jsonwebtoken: these help us with creating "sessions" so that a user can stay loged in etc. a bit complicated, copied the tutorial for that.
  • formidable let's us work with forms, which we will see coming up probably creating a form for our signin etc.
  • shortid was a tool we used to create a unique username for each user.
  • sligify: will let us create turn the title of each blog post into slug format, which-means-it-is-separated-by-dashes and helps with SEO performance
  • string-strip-html i think will let us create and excerp of the beginning of each blog and add that as a metatag to each blog page, also good for SEO.