Giter Club home page Giter Club logo

pbaas's Introduction

Progress Bars As A Service

Keep track of the progress of, well, anything!

HTTP Interface

HTTP defaults to application/json unless you set the Accept header to application/text.

POST /

Create a new progress bar value.

$ curl -vX POST localhost:9999/
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9999 (#0)
> POST / HTTP/1.1
> Host: localhost:9999
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Tue, 06 Feb 2018 15:36:54 GMT
< Content-Length: 81
<
{"id":"81a8a58e-85e7-425d-95f3-66542e4c4212","progress":0,"token":"CNuYC19tDJ4"}

PUT /{id}

Update a progress bar value.

$ curl -vX PUT -d "token=CNuYC19tDJ4&progress=10" localhost:9999/81a8a58e-85e7-425d-95f3-66542e4c4212
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9999 (#0)
> PUT /81a8a58e-85e7-425d-95f3-66542e4c4212 HTTP/1.1
> Host: localhost:9999
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Length: 29
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 29 out of 29 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Tue, 06 Feb 2018 15:37:11 GMT
< Content-Length: 60
<
{"id":"81a8a58e-85e7-425d-95f3-66542e4c4212","progress":10}

GET /{id}

Get a progress bar value.

$ curl -v localhost:9999/81a8a58e-85e7-425d-95f3-66542e4c4212
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9999 (#0)
> GET /81a8a58e-85e7-425d-95f3-66542e4c4212 HTTP/1.1
> Host: localhost:9999
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Tue, 06 Feb 2018 15:37:21 GMT
< Content-Length: 60
<
{"id":"81a8a58e-85e7-425d-95f3-66542e4c4212","progress":10}

gRPC

The gRPC client is in github.com/jmhobbs/pbaas/pb

Example

$ cat testClient.go
package main

import (
  "context"
  "log"

  "github.com/jmhobbs/pbaas/pb"
  "google.golang.org/grpc"
)

func main() {
  conn, err := grpc.Dial("127.0.0.1:12345", grpc.WithInsecure())
  if err != nil {
    log.Fatalf("did not connect: %v", err)
  }
  defer conn.Close()

  c := pb.NewProgressBarServiceClient(conn)

  r, err := c.NewProgressBar(context.Background(), &pb.NewProgressBarRequest{5})
  if err != nil {
    log.Fatalf("could not create progress bar: %v", err)
  }

  log.Println("New Progress Bar:", r)
}
$ go run testClient.go
2018/02/06 09:47:26 New Progress Bar: id:"1530d60f-0550-491a-88ee-e63b9a33ac02" token:"FIqsf2sV1h8"
$

pbaas's People

Contributors

almmiko avatar jmhobbs avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar

Forkers

almmiko

pbaas's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.