Giter Site home page Giter Site logo

openbrewerydb-fastapi's Introduction

๐Ÿป Official Open Brewery DB FastAPI REST API Server

Open Brewery DB Logo

๐Ÿ›‘ NOTE: WORK IN PROGRESS

The Open Brewery DB API server is a FastAPI REST-based API server connected to a PostgreSQL DB server.

Documentation

๐Ÿ“ฆ Dependencies

  • Python 3.10.6

๐Ÿš€ Getting Started

  • Create a virtual environment
    • python3 -m venv venv
  • Activate environment
    • source ./venv/bin/activate
  • Install dependencies
    • pip3 install -r requirements.txt
  • Run the tests
    • pytest
  • Run the server
    • uvicorn main:app
    • Change the host to any connection
      • --host=0.0.0.0
    • Change the port (8001 used as example)
      • --port=8001

Endpoints

  • https://localhost:8000/ (HTML)
  • https://localhost:8000/v1/healthcheck (JSON)

๐Ÿš› Roadmap

Task Complete?
Setup repo โœ…
README โœ…
Initial Unit/Request tests โœ…
Endpoint placeholders
Pydantic models
Update tests
DB Mocks
Query validation
Path validation
Sentry integration
Authentication
Rate-limiting

๐Ÿค Contributing

For information on contributing to this project, please see the contributing guide and our code of conduct.

๐Ÿ”— Related

๐Ÿ‘พ Community

๐Ÿ“ซ Feedback

Any feedback, please email me.

Cheers! ๐Ÿป

openbrewerydb-fastapi's People

Contributors

chrisjm avatar dependabot[bot] avatar milsman2 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

milsman2

openbrewerydb-fastapi's Issues

Build tests

From OBDB Rails API spec tests

Breweries API
  GET /breweries/meta
    returns meta data about all breweries
    returns status code 200
    returns meta data filtered by by_postal
    returns meta data with per_page
    returns meta data with page
    returns meta data filtered by by_state
    returns meta data filtered by by_country
  DELETE /breweries/:id
    return a routing error
  POST /breweries
    when the request is valid
      returns returns a routing error
  GET /breweries/:id
    when the record does not exist
      returns a not found message
      returns status code 404
    when the record exists
      returns status code 200
  PUT /breweries/:id
    when the record exists
      returns a routing error
  GET /breweries/random
    returns a brewery
    does not return more breweries than the max allowed
    returns a number of breweries when size param
    returns status code 200
  GET /breweries
    when distance param is passed
      throws a 400 error when invalid params
      returns 200 when valid params
    when sort param is passed
      returns a sorted list of breweries
    when no params are passed
      returns the default number of breweries
      returns Cache-Control headers
      returns status code 200
    when by_state param is passed
      sanitizes for SQL LIKE %
      sanitizes for SQL LIKE \
      returns a filtered list of breweries
      returns empty list when abbreviation
      returns a filtered list when utf-8
      returns empty list when mispelled
      returns a filtered list of breweries with snake case
      returns empty list with kebab case
    when exclude_types param is passed
      returns a filtered list of breweries - single
      returns a filtered list of breweries - multiple
    when by_type param is passed
      returns a filtered list of breweries, when valid type
      throws a 400 error, when invalid type
    when by_city param is passed
      returns a filtered list of breweries
    when by_country param is passed
      returns a filtered list of breweries
    when postal param is passed
      returns a filtered list of breweries for US postal code ZIP+4
      returns a filtered list of breweries for international postal codes
      returns a filtered list of breweries for US postal codes
    when page param is passed
      returns another page of breweries
    when invalid params are passed
      returns a status of 200
      returns the default number of breweries
    when by_name param is passed
      returns a filtered list of breweries
    when per_page param is passed
      returns a limited number breweries
      does not exceed the maximum number of breweries per page

Brewery
  #address
    returns a full address
  #model_validation
    when country is US
      when state is nil
        fails validation
      when state is present
        validates successfully
    when country is not US
      validates successfully

Per the above link, this should be a relatively easy translation assuming Ruby and Python knowledge. If not, let me (@chrisjm) know :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.