Skip to content

gasbo/simple-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A simple REST API created with Flask.

Installation & Tests

  • make build: Build the docker images. There are two of them: the mysql db and the proper app. Otherwise you can pull from Dockerhub (gasbo/simple-api-db and gasbo/simple-api-app).

  • make run PORT=8000: Run the containers and start the application.

  • make test: Run the test.

  • make stop: Stop both containers.

API Reference

Current Endpoints:

  • Get a user balance
  • Get a transfer
  • Create a transfer

Get a user balance

GET /userbalance/{user_id} will return the current balance of the user.

Get a transfer

GET /transfer/{transfer_id} will return the transfer.

Create a transfer

POST /transfer will create a new transfer.

[
  {
    "from_user_id": 1,
    "to_user_id": 2,
    "amount": 0.01,
    "description": "test",
  }
]

This will return 200 OK with the location of the new transfer. For example:

[
  {
    "location": "http://localhost:8000/api/transfer/4"
  }
]

Todos

  • Implement oauth2
  • Rate limiting

About

Simple Flask API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published