Giter Club home page Giter Club logo

petstore's Introduction

PetStore 🐢🐱πŸͺ

This is a Go server that implements the PetStoreService API. It's hosted on fly.io, at petstore.fly.dev. The source code is at github.com/stefanvanburen/petstore.

Usage

You can interact with the API with plain HTTP requests (via the Connect protocol) with any HTTP client, such as cURL, but buf curl makes it easy:

$ # Create a pet
$ buf curl \
  --data '{"name": "Mobin", "petType": "PET_TYPE_CAT"}' \
  https://petstore.fly.dev/pet.v1.PetStoreService/PutPet | jq .pet.petId
"01GT4XTKXEXY74QD8H575E8NWC"

$ # Retrieve a pet
$ buf curl \
  --data '{"petId":"01GT4XTKXEXY74QD8H575E8NWC"}' \
  https://petstore.fly.dev/pet.v1.PetStoreService/GetPet | jq .pet.name
"Mobin"

$ # Delete a pet. :(
$ buf curl \
  --data '{"petId":"01GT4XTKXEXY74QD8H575E8NWC"}' \
  https://petstore.fly.dev/pet.v1.PetStoreService/DeletePet
{}

You can also use Buf Studio to interact with the API in a much more interactive way.

Implementation details

The server uses the connect-go library to implement the API, with connectrpc/grpcreflect-go adding support for the gRPC server reflection API.

The packages used for interacting with the API are remotely generated - there's no code generation in this repository.

The "database" is completely in memory, so each deploy will wipe out any existing data.

petstore's People

Contributors

dependabot[bot] avatar jub0bs avatar stefanvanburen avatar

Stargazers

 avatar

Watchers

 avatar  avatar

petstore's Issues

`buf curl` with reflection service doesn't work

$ buf curl --data '{"name": "Mobin", "petType": "PET_TYPE_CAT"}' https://petstore.fly.dev/pet.v1.PetStoreService/PutPet
Failure: failed to resolve symbol "pet.v1.PetStoreService": unknown: HTTP status 505 HTTP Version Not Supported

Create README

Ideally, would have a few examples of how to use the service (first with curl, and then maybe once #2 is done, links to Buf Studio?).

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.