Hello fellow developers! 👋
I am a freshly graduated software developer, I am currently working on creating a RESTful API using Node.js with Express and PostgreSQL. I am almost done with the endpoints, but now I am looking to implement an authentication process so that users can have the option to log in when using my API in their frontend applications.
However, I am feeling a bit lost on where to start with authentication in my API. I am using an MVC architecture, and I'm not sure where to implement and write the authentication code. Should I create a completely separate file to handle authentication? I would greatly appreciate any advice or guidance on how to proceed with implementing authentication in my API.
My Github Repo if you want to have a look at my code:https://github.com/vincenzochiovaro/Mealtime-backEnd
Thank you in advance for your help, and I apologize for any confusion or lack of experience in this area.
Top comments (1)
I'd recommend creating a separate file for handling Authentication, and name it AuthenticationController.js for example. express-jwt is a good module to start implementing authentication API.
Happy Coding! ^^