I Designed Delicia, A RESTFUL API
Hello 👋 and welcome, I’m undergoing a refinery process with The Startup Intern. During this process, I’ll be provided with study resources and tasks that will help solidify my learning. On successful completion of this process, I’ll be assigned to an organization as a backend developer intern. Kindly check out The Startup Intern on their website or on Twitter to know more about them and what they do. 🤝
This article is based on task 5 and here is my previous article.
Back To The Topic
I designed a REST API for a food ordering app (which I named Delicia) with TypeScript, Node.js, Express.js, Mongoose, and POSTMAN for endpoints test collection and documentation.
While doing this task, I picked a lot of new things such as some dev/dependencies (my favorites are “module-alias” and “xss-clean”), how to set environment variables in POSTMAN, hosting the database on the cloud with MongoDB Atlas, deploying the API to Heroku and how typescript works with express.js.
It was an interesting yet challenging task as I get to put together all I have learned from tasks 1 to 4 and I also get to realize that I had forgotten so many concepts.
Challenges While learning 😞
I encountered so many blockers which in turn helped me learn how to search for the right answers using the error type while also getting familiar with forums like StackOverflow and GitHub gist.
- The first error I encountered was at the beginning of the project. While setting up my development environment, I decided to update Git on my local machine. For some reason, it failed as I got the error; .NET Framework 4.7.2 has not been installed because: HRESULT 0x800f0922. I tried almost every solution posted online for the error message, but none did work on my local machine. My solution was to install a lower/previous version of Git.
- I had some challenges with typescript express typings, for example, I couldn’t access request methods such as the req.user directly as I would in common js, and I had to explicitly declare the typing for express “Request” and “xss-clean” module. Here is a StackOverflow solution that helped.
- Another was while trying to push my repository to Heroku, I encountered an error:! [rejected] main -> main (non-fast-forward). Thankfully, there is an answer to the same error question on StackOverflow.
What Next? 🚀
I will be improving on the API by refactoring some codes and then adding more features such: as error handling, email verification, image/file upload, and payment API integration.
Here is a link to the GitHub repository.