REST API using Dart
This API provides endpoints for authentication and managing user posts. It is built using the Dart programming language and connects to Firebase for authentication and MongoDB Atlas for storing data.
- Dart SDK
- Firebase account and API credentials
- MongoDB Atlas account and cluster connection information
Postman workspace URL:
- GET / Check if the server is running
- POST /api_v1/auth/signup Create a new user account
- POST /api_v1/auth/signin Sign in to an existing user account
- GET /api_v1/auth/checkauth Check if the user’s token is valid and not expired
- POST /api_v1/auth/resetpassword Reset the password for a user account
- POST /api_v1/user/newpost Create a new post
- GET /api_v1/user/allposts Retrieve all posts
- GET /api_v1/user/myposts Retrieve all posts by the current user
- GET /api_v1/user/post/ Retrieve a specific post by id
- GET /api_v1/user/mypost/ Retrieve a specific post by id that belongs to the current user
- PUT /api_v1/user/updatepost/ Update a specific post by id that belongs to the current user
- DELETE /api_v1/user/deletepost/ Delete a specific post by id that belongs to the current user
The project is connected to the following services:
- Firebase: For user authentication.
- MongoDB Atlas: For storing and retrieving data.
Set up your Firebase credentials
Create a file called firebase.json in the root of the project, and add your Firebase API key and other relevant information.
Running the API
To run the API, use the following command:
- Clone the repository:
git clone https://github.com/fahad0100/Example-of-building-a-Restful-API-in-the-Dart-.git
- Change into the project directory:
- Install the dependencies:
dart pub get
- Run the server:
We welcome contributions to this project. If you have an idea for an improvement or a bug to report, please open an issue. If you would like to make a change yourself, please follow these steps:
- Fork the repository.
- Create a new branch for your changes.
- Make your changes.
- Commit and push your changes to your branch.
- Open a pull request.
You can also contact me at [email protected] for further discussions.