This is the back-end repository for a Flutter notes app that uses MongoDB as its database and Node.js for the server. This README will guide you through setting up and running the back-end server.
Before you begin, ensure you have the following installed on your system:
- Node.js: Installation Guide
- MongoDB: Installation Guide
-
Clone the repository to your local machine:
git clone https://github.com/yourusername/flutter-backend-notes-app.git
-
Change to the project directory:
cd flutter-backend-notes-app
-
Install Node.js server dependencies:
npm install
-
Configure MongoDB:
- Start your MongoDB server.
- Create a new MongoDB database and collection for this app.
-
Configure environment variables:
-
Create a
.env
file in the root directory of the project. -
Define the following environment variables in the
.env
file:MONGODB_URI=your_mongodb_uri PORT=your_server_port
Replace
your_mongodb_uri
with the MongoDB connection URI andyour_server_port
with the desired server port.
-
-
Start the Node.js server:
npm start
The back-end server is now up and running.
- Endpoint:
/api/notes
- Method: GET
- Description: Get a list of all notes from the MongoDB database.
-
Endpoint:
/api/notes
-
Method: POST
-
Description: Create a new note in the MongoDB database.
-
Request Body:
{ "title": "Your Note Title", "content": "Your Note Content" }
-
Endpoint:
/api/notes/:noteId
-
Method: PUT
-
Description: Update an existing note in the MongoDB database.
-
Request Body:
{ "title": "Updated Note Title", "content": "Updated Note Content" }
- Endpoint:
/api/notes/:noteId
- Method: DELETE
- Description: Delete a note from the MongoDB database.
Feel free to contribute to this project by opening issues or submitting pull requests. Please follow the code of conduct and contribution guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to the Node.js and MongoDB communities for their excellent documentation and support.
You've successfully set up the back-end server for your Flutter notes app. If you have any questions or encounter any issues, please don't hesitate to reach out for assistance.