GithubHelp home page GithubHelp logo

lducharme / xrpc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nordstrom/xrpc

0.0 1.0 0.0 6.96 MB

Simple, production ready Java API server built on top of functional composition.

License: Apache License 2.0

Shell 1.96% Java 97.87% Groovy 0.18%

xrpc's Introduction

xrpc

Build Status Download

Xrpc is a framework for creating production quality API services on top of Netty. The framework helps to encapsulate our best practices and provides sane (and safe) defaults.

It currently supports the http/1.1 and the http/2 protocols. It does so interchangeably, i.e your implementation does not need to change and it will automatically respond to a http/1.1 and a http/2 client the same way. The user is free to determine whatever payload they would like, but our recommendation is JSON where you don't control both ends and protobuf (version 3) where you do.

Testing with the Example class

# Building the jar

```shell
$ ./gradlew shadowJar

Running the jar

$ java -jar app.jar

Running the people demo app in a test server

$ ./bin/startPeopleTestServer.sh

Basic http set

$ curl -k -d "bob" -X POST https://localhost:8080/people

Basic http/2 get

--! This demo requires curl with http/2 !-- (see https://simonecarletti.com/blog/2016/01/http2-curl-macosx/)

$ curl -k  https://localhost:8080/people
[{"name":"bob"}]
$ curl -k  https://localhost:8080/people --http1.1
[{"name":"bob"}]

Running the dino demo app in a test server

Run the dino app server to demo proto buffer handling.

$ ./bin/startDinoTestServer.sh

Proto http set

--! This demo requires curl with http/2 !-- (see https://simonecarletti.com/blog/2016/01/http2-curl-macosx/)

$ java -cp app.jar com.nordstrom.xrpc.demo.DinoSetEncoder trex blue | curl -k  https://localhost:8080/DinoService/SetDino --data-binary @- -vv

Proto http get

$ java -cp app.jar com.nordstrom.xrpc.demo.DinoGetRequestEncoder trex | curl -k -s https://localhost:8080/DinoService/GetDino --data-binary @-
trexblue

Admin routes

xrpc comes with some built in admin routes. See also Router.java and AdminHandlers.java

  • /metrics -> Returns the metrics reporters in JSON format
  • /health -> Expose a summary of downstream health checks
  • /ping -> Responds with a 200-OK status code and the text 'PONG'
  • /ready -> Exposes a Kubernetes or ELB specific healthcheck for liveliness
  • /restart -> Restart service (should be restricted to approved devs / tooling)
  • /killkillkill -> Shutdown service (should be restricted to approved devs / tooling)

Contributing

Please see the contributing guide for details on contributing to this repository.

xrpc's People

Contributors

xjdr avatar jkinkead avatar pdex avatar spenserpothier avatar andyday avatar lducharme avatar patrickdent avatar

Watchers

 avatar

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.