Below is an example write-up you can use for your Simple REST API:
Inspiration
We were inspired by the idea of creating a lightweight, accessible API that anyone can deploy and use. Our goal was to build something simple yet effective—a starting point for developers who want to understand the fundamentals of RESTful services without overwhelming complexity.
What it does
This API serves as a basic RESTful endpoint that returns a simple message ("Welcome to my simple REST API, Iñaki is a bot JAJAJA") when accessed. It acts as a proof-of-concept for how a minimal Node.js API can be built and deployed, making it easy for users to extend its functionality as needed.
How we built it
We built the API using Node.js and Express, taking advantage of modern development tools to keep our code clean and efficient. The steps included:
- Setting up the project with npm and installing essential packages like Express, CORS, and Body-Parser.
- Writing a concise
index.jsthat defines our endpoint and handles basic routing. - Deploying the application on an OCI Virtual Machine.
- Using PM2 to manage the Node.js process and ensure it runs continuously.
- Configuring the firewall (via firewalld) to make the API accessible externally.
Challenges we ran into
Our main challenges were deploying the API on OCI and making it visible to everyone:
- Deployment hurdles: Configuring the OCI VM, installing Node.js, and dealing with permission issues during global package installations.
- Visibility: Opening the appropriate ports in the VM’s firewall and ensuring that the API was accessible from the internet.
- Process Management: Setting up PM2 correctly to ensure that our API restarts on reboot and continues running smoothly.
Accomplishments that we're proud of
- Successfully deploying a functioning REST API on a cloud VM.
- Overcoming permission and configuration issues during installation.
- Automating process management with PM2 and configuring firewalld to secure our endpoints.
- Creating a solid foundation for future enhancements without unnecessary complexity.
What we learned
- The importance of understanding and configuring your cloud environment (OCI in our case) to ensure proper network and security settings.
- How to manage Node.js processes in production using PM2.
- Best practices for setting up a basic API with essential middleware for handling requests and enabling CORS.
- Troubleshooting common deployment issues, such as permission errors and firewall configurations.
What's next for Simple REST API
- Feature Expansion: Adding more endpoints and integrating business logic to turn the simple API into a more robust service.
- Security Enhancements: Implementing authentication, rate limiting, and SSL/TLS encryption.
- Scalability: Considering options for scaling the application horizontally, perhaps through load balancing or containerization.
- Monitoring and Logging: Integrating monitoring tools and centralized logging to ensure smooth operation and quick troubleshooting.
Log in or sign up for Devpost to join the conversation.