This project is a backend API for the "Happy Thoughts" application, which allows users to post, view, like, and delete happy thoughts. The API is built using Node.js, Express, and MongoDB.
The goal of this project is to create a robust and scalable API that supports various operations related to thoughts. The API defines a Thought model with specific validations for the message, hearts, and createdAt properties.
Used as the runtime environment for the server.
Chosen as the web framework for handling HTTP requests and responses.
Utilized as the database for storing thoughts.
An ODM library for MongoDB, used to model thoughts and interact with the database.
Configured to handle environment variables, such as the MongoDB connection string.
Integrated to automatically generate API documentation.
The project follows RESTful conventions with endpoints for retrieving all thoughts, creating a new thought, retrieving a specific thought by ID, updating hearts on a thought, and deleting a thought.
Defined a Thought model with proper validations for the message, hearts, and createdAt properties.
Implemented routes for CRUD operations on thoughts using Express.
Established a connection to MongoDB, allowing the API to persistently store and retrieve thoughts.
Implemented error handling for various scenarios, providing meaningful responses.
Deployed the API to MongoDB Atlas to make it accessible online.
Given more time, I would consider the following enhancements:
Implement user authentication to allow users to have personalized experiences.
Add support for paginating through large sets of thoughts.
Implement comprehensive testing for the API using tools like Mocha and Chai.
Integrate logging to capture and analyze application events.
The API is live and can be accessed at Project Happy Thoughts API.
- The endpoint "/" returns documentation of Happy-Thoughts API Express List Endpoints.
- A minimum of one endpoint to return a collection of results (array of elements) is available at Thoughts Collection.
- A minimum of one endpoint to return a single result (single element) is available at Single Thought.
Feel free to explore the various endpoints and interact with the API using your preferred API client or tools like Postman.
Feel free to explore the various endpoints and interact with the API using your preferred API client or tools like Postman.