Coder Social home page Coder Social logo

wkit-workshop's Introduction

Amalone Books Python API

Running in Codesandbox - this part is correct and you can trust it <3

  1. Install dependencies:
pip install -r requirements.txt
  1. Run FastAPI server:
uvicorn main:app --reload
  1. Ensure that everything works, in a new terminal write
curl 127.0.0.1:8000/health

Ensure that you get OK back.

  1. Run tests:
pytest .
  1. Populate database:
python populate.py

Ensure you get products:

curl 127.0.0.1:8000/products

Introduction

This is the documentation for our FastAPI application. It's a basic app, not too fancy. Does some stuff with products and orders, you know, the usual for books.

Setup

To set it up, just run it using some new Python version. You'll figure it out.

Database

We're using SQLite because it's easy and very fast with generating IDs. Just make sure you have a production.db file somewhere. If it doesn't work, just call me at +46 72 426 20 86, or talk to support.

Models

There are some models or something in Amalone:

  • Product: It's got an ID, name, category, and price.
  • OrderDetail: Connects orders and products, I guess.
  • Order: It's for orders. It has an ID, timestamp, and total price.

Endpoints

Here are some endpoints, that are very efficient and well written:

  • /products/: POST to add a product, GET to get all products. There's also a GET for a single product, but I forgot how it works.
  • /order/: POST to create an order. There's also a GET for all orders and a specific order, but I didn't really test those.

Tests

There are test with a lot of coverage, you probably don't have to run it manually too much.

Linting and formatting

Just install any linter you like on your machine, whatever floats your boat.

Notes

  • The documentation is up to date
  • Everything worked as expected the last time I tested...
  • Good luck!

wkit-workshop's People

Contributors

davidjungermann avatar mookth789 avatar tildadglas avatar

Watchers

 avatar

Forkers

tingzhb wkitemma

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.