This project provides a simple demo application for creating, reading, and deleting notes using a Python Flask API and a web frontend. The backend API uses MongoDB for data persistence, while the frontend uses vanilla JavaScript and Bootstrap for the UI. The app is containerized with Docker for easy deployment.
- RESTful API using Flask and MongoDB for CRUD operations on notes.
- Web frontend using Bootstrap.
- Dockerized backend and frontend services.
- Docker-compose for orchestrating services including MongoDB.
- Gunicorn for serving the Flask application.
- Nginx for serving the frontend.
- Docker
- Docker-compose
+--------+ HTTP +------------+ MongoDB +-------+
| Front | <-------> | Flask | <-----------> | DB |
|(Nginx) | API | (Gunicorn) | |(Mongo)|
+--------+ +------------+ +-------+
git clone https://github.com/blakelead/notes-demo-app.git
Run the following command to start the application:
docker-compose up
This will build and start the services defined in docker-compose.yml
.
- Frontend will be available at
http://localhost:5000
- API will be available at
http://localhost:8000
Request:
GET /api/notes
Response:
{
"notes": [
{
"_id": "note_id",
"note": "example_note"
}
]
}
Request:
POST /api/notes
Body:
{
"note": "New Note"
}
Response:
{
"message": "note note_id created"
}
Request:
DELETE /api/notes/note_id
Response:
{
"message": "note note_id deleted"
}
Request:
GET /api/status
Response:
{
"build_version": "dev",
"environment": "development"
}
- Add a Note: Use the "Ajouter une note" form to add a new note.
- Delete a Note: Click the "✖" icon next to the note to delete it.
MONGODB_URI
: MongoDB URI (default isdb:27017
)BUILD_VERSION
: Build version (default isdev
)ENVIRONMENT
: Application environment (default isdevelopment
)DEBUG
: Enable debug mode (default isTrue
)
API_URL
: URL of the API service (should be set indocker-compose.yml
)
MIT