📈 A RESTful API to buy/sell bitcoins 💸🌎
Get Started
Description
This is a representational application to buy and sell bitcoins built with Go (it means that you will not buy or sell real bitcoins here!).
Running
To run this application, you will need:
- Install Go
- Crete a database
- Set the name of created database in .env > DB_NAME (the default is bitcoins-exchange)
- Execute the main.go file
Routes
- Remember that all parameters should be passed in JSON format.
- You can get the swagger version of this API here
- You can get the postman collection of this API here
GET / (index)
A simple welcome message. You can use this route to test if the application is correctly running.
Success response example
HTTP 200 OK
POST /users
Creation of an user. The expected parameters are:
- name (String) - Ex.: Elon Musk
- email (String) - Ex.: elonmusk@spacex.com
- password (String) - Ex.: Rocket2moon@123
- dateofbirth (String) - Ex.: 1971-06-28
Success response example
HTTP 201 Created
GET /users
List existing users.
Success response example
HTTP 200 OK
POST /login
There are the login. The expected parameters are:
In success case, you will get a JWT that will be used in the next route.
Success response example
HTTP 200 OK
POST /orders
Crete an order. The expected parameters are:
- Bearer token (JWT obtained at Login. This parameter should be at HTTP Header (key Authorization)
- author_id (int) - Ex.: 3
- amount (int) - Ex.: 0.06
- action (String) - "buy" or "sell"
- date (String) - Ex.: "2020-03-29"
Success response example
HTTP 201 Created
GET /orders/user/:id
List all orders of the user. The expected parameter are:
Success response example
HTTP 200 OK
GET /orders/date/:date
List all orders realized in the date. The expected parameter are:
Success response example
HTTP 200 OK
Database
Database diagram
End
All routes have been documented, so thanks for reading and...