GeezerVison is showing github.com — 100-python-projects/API with RESTful Routing at main · bicky007/100-python-projects
/
API with RESTful Routing
/Copy pathDirectory actions
More options
More optionsDirectory actions
More options
More options/
API with RESTful Routing
/Copy pathFolders and files
| Name | Name | Last commit message | Last commit date |
|---|
parent directory.. |
| | | |
| | | |
| | | |
| | | |
|
Building Your Own API with RESTful Routing
- HTTP Requests (GET, POST, PUT, PATCH, DELETE)
- Postman Software
- Publish API Documentation
- Retrieve a random cafe: Get a random cafe from the database.
- Retrieve all cafes: Get a list of all cafes in the database.
- Search for a cafe: Find a cafe by location.
- Add a new cafe: Add a new cafe to the database.
- Update a cafe's coffee price: Update the coffee price of a specific cafe.
- Delete a cafe: Delete a cafe from the database by ID.
- Python 3.x
- Flask
- Flask-SQLAlchemy
- Clone the repository or download the script.
- Install the required libraries:
pip install Flask Flask-SQLAlchemy
- Create the database:
python
>>> from your_script_name import db
>>> db.create_all()
>>> exit()
- Ensure that the database URI is correctly set in the script:
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///cafes.db'
- Run the Flask application:
python your_script_name.py
- Access the API endpoints through a tool like Postman or via your web browser.
