Skip to content

A golang package that provides a micro-framework for RESTful web services

License

Notifications You must be signed in to change notification settings

SpirentOrion/luddite

Folders and files

NameName
Last commit message
Last commit date
Jan 12, 2018
Jul 31, 2024
Feb 8, 2017
Jun 6, 2024
Feb 8, 2017
Oct 12, 2020
Oct 12, 2020
Oct 18, 2017
Sep 29, 2016
Oct 18, 2017
Jul 12, 2017
Nov 1, 2017
Jul 13, 2015
Apr 5, 2017
Apr 4, 2017
Sep 23, 2015
Apr 7, 2015
Aug 25, 2016
Jan 26, 2018
Apr 23, 2015
Feb 8, 2016
Aug 25, 2016
Aug 25, 2016
Aug 25, 2016
Jan 13, 2018
Jan 12, 2018
Jul 23, 2015
Jun 6, 2017
Jan 12, 2018
Aug 25, 2016
Aug 25, 2016
Aug 25, 2016

Repository files navigation

Luddite service framework package

Luddite is a golang package that provides a micro-framework for RESTful web services. It is built around extensible, pluggable middleware layers and includes a standard Resource interface that makes it easy to implement services that comply with the Orion REST API Standards.

To run the example service:

$ cd example
$ go build .
$ ./example -c config.yaml

Resources

Two types of resources are provided:

  • Singleton: Supports GET and PUT.
  • Collection: Supports GET, POST, PUT, and DELETE.

Resources may also implement POST actions and be made read-only. Since luddite is a micro-framework, implementations retain substantial flexibility.

Middleware

Currently, the framework registers several middleware handlers for each service:

  • Bottom: Combines CORS, tracing, logging, metrics, and recovery actions. Tracing generates a unique request id and optionally records traces to a persistent backend. Logging logs requests/responses in a structured JSON format. Metrics increments basic request/response stats. Recovery handles panics that occur in HTTP method handlers and optionally includes stack traces in 500 responses. Also makes the Service instance, request id, and response headers available to resource handlers as part of the request [context][context].
  • Negotiation: Performs JSON (default) and XML content negotiation based on HTTP requests' Accept headers.
  • Version: Performs API version selection and enforces the service's min/max supported version constraints. Makes the selected API version available to resource handlers as part of the request [context][context]. [context]: http://blog.golang.org/context

TODO

Need to document these:

  • Metrics
  • Schema file serving
  • TLS requirements
  • Min/max versioning