Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/imdaaniel/bitcoins-rest-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/imdaaniel/bitcoins-rest-api

  • v0.0.0-20201128020739-03c6deb2ac86
  • Source
  • Go
  • Socket score

Version published
Created
Source

📈 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.: 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:

  • 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...

FAQs

Package last updated on 28 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc