Giter VIP home page Giter VIP logo

microservice-python's Introduction

microservice-python-example

A small example of a REST like microservice written in python

The example is based on the flask library. Documentation can be found under: http://flask.pocoo.org/docs/1.0/

It implements the basic REST routes for an example customer resource.

GET / : Welcome Message
GET /customers : Retrieve all customers
GET /customers/<customer_id> : Retrieve a single customer resource
PUT /customers/<customer_id> : Update a single customer resource
DELETE /customers/<customer_id> : Delete a single customer resource
POST /customers : Create a new customer resource

POST /do_your_magic: Barebone example for a simple service
POST /calculate_price: (Simple) example for a possible price calculation

Additionally there is a endpoint called "do_your_magic" as an barebone example on how to implement a simple service.

Dockerfile

The example can be easily deployed and tested using docker. Just install docker and execute the following commands.

$ docker build . -t python-microservice-example
$ docker run --name python-microservice-example_1 -d -p 5000:5000 python-microservice-example

After the docker container is up and running you will be able to access the microservice via HTTP calls. Go to your browser and enter: http://localhost:5000/customers You should now see a list of example customer resources.

I recommend to use POSTMAN (https://www.getpostman.com/) to test the other methods, like POST, PUT and DELETE You will find a postman_collection.json file next to the other sources, that you can import into POSTMAN.

microservice-python's People

Contributors

ebroda avatar mbeuttler 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.