After developing a basic API with ExpressJS to interact with MongoDB for CRUD operations, I successfully ran it locally using the command "npm nodemon" in the source folder. Testing it with Postman confirmed its functionality. Now, my concern is how to deploy it on the server. Our server operates on a Linux system, and I have the following line of code in my main file "server.js
":
const port = process.env.PORT || 5000;
I suspect that the process.env.port
variable needs to be updated to function correctly on the server?
Furthermore, I explored AWS EC2 servers, but found them to be quite overwhelming. I am seeking advice from someone to suggest a straightforward and specific solution for a beginner like myself to host my ExpressJS scripts on a server environment. Thank you.