Giter Club home page Giter Club logo

lettergun-server's Introduction

lettergun-server

This FastAPI server exposes an endpoint (the "webapp endpoint") which the lettergun webapp can contact to initiate letter writing.

The FastAPI app validates the webapp's JSON payload, then sends it to the lettergun-handwriting app. If the payload is valid it returns an 200 response.

lettergun-handwriting parses the JSON to create an svg image of the handwritten note. It sends the image to the image endpoint on the API server.

The API server verifies the SVG image against the original JSON payload and if it is valid, used the AxiDraw Python API to plot the SVG image. When the image is complete, it notifies the API server, which notifies the webapp.

Documentation

Docker

Use the following command whilst developing to build and run a docker image based on current code:

docker stop container-one && docker rm container-one && docker build -t image-one . && docker run -d --name container-one -p 80:80 image-one

To shell into it and run the tests:

docker exec -it container-one pytest app/

Running locally

Once the container is running, and assuming you've mapped the ports to 80:80, you can go to http://127.0.0.1/.

You can experiment with API requests by using httpie. Use the command https http://127.0.0.1 to get started.

http post http://127.0.0.1/api/v1/create/ uid=foo message="Dear {name}, Good bye." "variables[0][name]=Joe" "variables[0][product]=tshirt" paper_size=A6 paper_orientation=landscape paper_type=p1

Testing

To run the test suite: docker exec -it container-one pytest app/

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.