Giter VIP home page Giter VIP logo

jammer-backend-training's Introduction

Jammer Backend (RESTful with Eve)

This is the seed and prototype of REST-ful backend for Jammer.

This is an Eve app using a standard image for Mongo container and mutated offspring of Alex Pankov's Eve Dockerfile for API box.

Prerequisites

Both can be installed on Ubuntu by the included startmeup script.

Sadly, if you were not previously a member of the docker group, there will be unavoidable pain cause by how credentials are propagated in Ubuntu.

If you're not on Ubuntu, you have WSL or some other bad things happen, check special cases.

RUN

The repo includes docker-compose.yml. To use it run:

docker-compose up

You can curl http://0.0.0.0:5000/cokolwiek as soon as containers are started. App code volume is mounted live to the container and the app is run with gunicorn --max-requests=1 so that each manual debugging request reloads code.

toot.py

toot is a Python minitool for calling the API with input and output data specified in YAML.

Input data for POST and PUT requests is read from stdin (press Ctrl+D in empty line to finish)

Usage:

./bin/toot.py [POST|PUT|DELETE] PATH

durl

durl is a little wrapper for curl, preset to go to http://0.0.0.0:5000 and to send response to json_pp.

  • Main parameter is the path.
  • It can be followed by JSON data (remember to use quotes!) for POST and PUT
  • It can be preceded by 'put' or 'del' to send a PUT/DELETE request.

Usage:

./bin/durl [put|delete] PATH [DATA]

with path specified as first non-verb parameter and post data as last (json). It will try to use json_pp to print out the results.

Changing dependencies

If you modify dependencies, you need to rebuild the images:

make
make build

Default target builds the dev container as akseiya/jammer-backend-dev with dev dockerfile,as expected by the docker-compose.yml.

build target only needs to be run for deployments.

Everyone is a bit special

I'm on WSL, please help!

You'll need Docker Desktop for Windows 10 and make it a remote docker server for your WSL. Nick Janetakis knows how.

No can tainer!

You then need to:

  • make sure you have Python 3.8 and its very own PIP;
  • install dependencies with the right PIP;
  • point python to Python 3.8;
  • run Mongo standalone listening where Eve expects it;
  • run gunicorn --max-requests=1 -b 0.0.0.0:5000 app.app:app from repo root;
  • pray.

jammer-backend-training's People

Contributors

akseiya avatar tselbirak avatar

Watchers

James Cloos avatar  avatar

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.