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

github.com/tudorleu/button

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/tudorleu/button

  • v0.0.0-20150226212000-7d344f02b398
  • Source
  • Go
  • Socket score

Version published
Created
Source

button

Installation

The project is set up according to the Go standards, so commands such as go install and go build should work. You may need to install some dependencies, which godep might help with.

The port on which the server starts is taken from an environment variable, so after building, start with: PORT=1234 button.

API

  • POST /user - Creates a new user, returns a User object. Parameters: email, firstName, lastName.
  • GET /user/:id - Retrieves a user with the given id.
  • POST /user/:id/transfer - Creates a transfer for the given user. Parameters: amount
  • GET /user/:id/transfers - Lists the transfers for the given user.

Examples:

$ curl -X POST https://arcane-sands-6945.herokuapp.com/user -d email=test@test.com -d firstName=Jack -d lastName=White
{"userId":1,"email":"test@test.com","firstName":"Jack","lastName":"White","points":0}

$ curl -X GET https://arcane-sands-6945.herokuapp.com/user/1
{"userId":1,"email":"test@test.com","firstName":"Jack","lastName":"White","points":0}

$ curl -X POST https://arcane-sands-6945.herokuapp.com/user/1/transfer -d amount=10
{"id":1,"userId":1,"amount":10}

$ curl -X GET https://arcane-sands-6945.herokuapp.com/user/1
{"userId":1,"email":"test@test.com","firstName":"Jack","lastName":"White","points":10}

$ curl -X GET https://arcane-sands-6945.herokuapp.com/user/1/transfers
[{"id":1,"userId":1,"amount":10}]

$ curl -X POST https://arcane-sands-6945.herokuapp.com/user/1/transfer -d amount=-20
{"error":"Insufficient points"}

$ curl -X POST https://arcane-sands-6945.herokuapp.com/user/1/transfer -d amount=-10
{"id":2,"userId":1,"amount":-10}

$ curl -X GET https://arcane-sands-6945.herokuapp.com/user/1
{"userId":1,"email":"test@test.com","firstName":"Jack","lastName":"White","points":0}

$ curl -X GET https://arcane-sands-6945.herokuapp.com/user/1/transfers
[{"id":1,"userId":1,"amount":10},{"id":2,"userId":1,"amount":-10}]

FAQs

Package last updated on 26 Feb 2015

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