Skip to content

Siya016/Cafe-Api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cafe API

This repository contains the source code for a RESTful API that manages information about cafes. Developers can use this API to perform various operations such as retrieving a list of all cafes, getting a random cafe, searching for cafes based on location, adding a new cafe, updating the coffee price of a cafe, and deleting a cafe by its ID. The API follows RESTful routing principles for a well-organized and predictable structure.

Technologies Used

  • Flask: A lightweight web framework for building the API.
  • SQL Alchemy: A SQL toolkit and Object-Relational Mapping (ORM) library for working with databases.
  • Postman: A popular API testing tool for testing and exploring the functionality of the API.

Getting Started

  1. Clone the repository:

               git clone https://github.com/Siya016/Cafe-Api.git

  1. Install dependencies:

               pip install -r requirements.txt

  1. Set up the database:

                flask db init

                flask db migrate

                flask db upgrade

  1. Run the application:

                 flask run

API Endpoints

1. Get All Cafes

  • Endpoint: GET /cafes
  • Description: Retrieve a list of all cafes.

2. Get Random Cafe

  • Endpoint: GET /cafes/random
  • Description: Get information about a randomly selected cafe.

3. Search Cafe by Location

  • Endpoint: GET /cafes/search?location={location}
  • Description: Search for cafes based on their location. The location parameter allows filtering by a specific geographical area.

4. Post New Cafe

  • Endpoint: POST /cafes
  • Description: Add a new cafe to the system. Requires providing details such as name, location, and coffee price.

5. Update Coffee Price

  • Endpoint: PUT /cafes/{id}/price
  • Description: Update the price of coffee for a specific cafe identified by its unique ID. Requires providing the new coffee price.

6. Delete Cafe by ID

  • Endpoint: DELETE /cafes/{id}
  • Description: Delete a cafe from the system based on its unique ID.

 

 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published