-
The homepage for the API application
-
The Swagger UI for the API documentation and for testing in production. Simplify select the production server to start testing the endpoints
-
A successful request and response to get all users in the database.
-
The endpoints were also tested using ThunderClient, which is a lightweight VSCode extension for testing APIs
Inspiration
The inspiration for this project stemmed from the need to create a simple yet scalable CRUD (Create, Read, Update, Delete) application that demonstrates best practices in modern web development. I wanted to build something robust enough for real-world use while keeping it beginner-friendly for educational purposes.
What it does
This is RESTful API application that allows users to perform basic database operations: Create: Add a new user to the database. Read: Retrieve all users in the database. Retrieve only specified user. Update: Modify existing user data Delete: Remove a user from the database. The application uses Swagger UI to provide interactive API documentation, enabling users and developers to explore and test endpoints effortlessly.
How I built it
Backend: Built with Node.js using the Express.js framework for routing and middleware. Integrated with a PostgreSQL database hosted on Heroku to manage data storage. API Documentation: Used Swagger UI to document all the available API endpoints interactively. Hosting: The entire application is deployed on Heroku, leveraging its ease of use for scaling and continuous deployment. I am able to use Heroku essential-0 plan which is a paid plan due to subscribing to GitHub's Student Developer Pack!. Thank you GitHub!
Challenges I ran into
Database Integration: Managing database connections efficiently, I had to read a few medium articles on how to connect my heroku postgres database to my application. Also the Heroku docs was helpful in setting up the postgres database.
Deployment: Configuring environment variables for production while keeping sensitive data secure in a .env file and removing the .env file from version control.
API Documentation: Ensuring that the Swagger documentation accurately reflected all changes made to the API. Read their docs on how to set it up for a node.js project.
API testing: I used thunderclient to test my api-endpoints as well as swagger to test endpoints for both locally and in production environments.
Accomplishments that I'm proud of
- Successfully deployed a fully functional RESTful API on Heroku.
- Integrated Swagger UI to make the API accessible and user-friendly for both developers and non-developers.
What we learned
- How to build and deploy a Node.js application integrated with PostgreSQL.
- The importance of documenting APIs for usability and collaboration.
- Techniques for managing environment variables and secrets securely.
What's next for CRUD Hack
- Frontend Integration: Develop a simple frontend interface to interact with the API.
Built With
- express.js
- heroku
- node.js
- postgresql
- swagger
- thunderclient
Log in or sign up for Devpost to join the conversation.