This repository contains a practice code for a RESTful API using Flask. The API is designed for a hypothetical cafe, allowing users to perform CRUD (Create, Read, Update, Delete) operations on the cafe data.
- Flask: A lightweight WSGI web application framework.
- Flask-SQLAlchemy: An extension for Flask that adds support for SQLAlchemy to your application.
- Flask-Limiter: An extension for Flask that provides rate limiting features.
- dotenv: A zero-dependency module that loads environment variables from a
.envfile intoprocess.env.
- GET /all: Fetch all cafes from the database.
- GET /random: Fetch a random cafe from the database.
- GET /search: Fetch cafes from the database based on a location query.
- POST /add: Add a new cafe to the database.
- PATCH /update/int:cafe_id: Update the price of a specific cafe.
- DELETE /delete/int:cafe_id: Delete a specific cafe from the database.
- Clone this repository.
- Install the dependencies using pip:
pip install -r requirements.txt - Run the application:
python main.py
This is a practice project and is not intended for production use. The API key is stored in an environment variable for security purposes. Please replace it with your own secret key.
Contributing is welcome.