Building a socket api with node js, express, websocket, mongoDB and firecamp: (User profile)

Joshua Isaac
2 min readOct 12, 2020

This is a continuation from the first Login and registration and it is going to be prety brief since most of the concepts in this article were handles in our previous article.

Okay let us get started by creating a middleware for our application. We dont want just anyone to create a profile unless authenticated.

  • Create an auth.js file with and exported authenticate function which accepts a jwt token as a parameter.
  • the function decodes the jwt and verify if user

Create a profile.action.js file and create all your actions in it and export them

Create a profileController.js file and import the actions and middleware modules

Now lets solder all the parts together in the server.js file. Import the profile controller

Next let us update our message with the exported modules in the profile controller.

Project link Github

After the next article on validation, there will be a code clean up and advance it.

--

--

Joshua Isaac

I am an experienced back-end software engineer adept in bringing forth expertise in design, installation, testing and maintenance of software systems.