Categorygithub.com/imdaaniel/bitcoins-rest-api
modulepackage
0.0.0-20241223194514-890fbe382741
Repository: https://github.com/imdaaniel/bitcoins-rest-api.git
Documentation: pkg.go.dev

# README

πŸ“ˆ 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:

  1. Install Go
  2. Crete a database
  3. Set the name of created database in .env > DB_NAME (the default is bitcoins-exchange)
  4. 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.: [email protected]
  • 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:

  • id - Ex.: 3

Success response example

HTTP 200 OK

GET /orders/date/:date

List all orders realized in the date. The expected parameter are:

  • date - Ex.: 2020-03-29

Success response example

HTTP 200 OK

Database

Database diagram

End

All routes have been documented, so thanks for reading and...

# Packages

No description provided by the author