request_id alternatives and similar shards
Based on the "Framework Components" category.
Alternatively, view request_id alternatives based on common mentions on social networks and blogs.
-
motion.cr
Motion is a framework for building reactive, real-time frontend UI components in your Amber application using pure Crystal that are reusable, testable & encapsulated. -
mochi
Mochi is a authentication shard inspired by devise. Mochi is designed for the Amber framework with support for both Granite & Jennifer ORM's.
InfluxDB - Purpose built for real-time analytics at any scale.
Do you think we are missing an alternative of request_id or a related project?
README
request_id
Middleware for generates / pick up a unique request ID for Crystal servers.
This module set response HTTP Header like this:
X-Request-ID: 753a468b-4179-40c4-bb58-ff508cb39d67
Installation
Add this to your application's shard.yml
:
dependencies:
request_id:
github: SuperPaintman/request-id
Usage
With pure Crystal server
require "request_id"
require "http/server"
server = HTTP::Server.new("0.0.0.0", 8080,
[
RequestID::Handler.new
]) do |context|
context.response.content_type = "text/plain"
context.response.print "Hello request id!"
end
server.listen
With Kemal
require "request_id"
require "kemal"
add_handler RequestID::Handler.new
get "/" do |env|
"Hello request id!"
end
Kemal.run
Custom Generator
By default:
uuid
require "request_id"
require "http/server"
class CustomRequestIDHandler < RequestID::Handler
def generator
"custom_request_id_generator"
end
end
server = HTTP::Server.new("0.0.0.0", 8080,
[
CustomRequestIDHandler.new
]) do |context|
context.response.content_type = "text/plain"
context.response.print "Hello request id!"
end
server.listen
Examples
Random ID
curl -I localhost:8080
# HTTP/1.1 200 OK
# X-Request-ID: 5e3df631-85e6-4eaf-bb1c-68375291332e
Set ID via Header
curl -I -H 'X-Request-ID:4ce4089d-e01e-4c7f-b35c-2ca383c7abf5' localhost:8080
# HTTP/1.1 200 OK
# X-Request-ID: 4ce4089d-e01e-4c7f-b35c-2ca383c7abf5
Test
crystal spec
Contributing
- Fork it (https://github.com/SuperPaintman/request-id/fork)
- Create your feature branch (
git checkout -b feature/<feature_name>
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin feature/<feature_name>
) - Create a new Pull Request
Contributors
- SuperPaintman SuperPaintman - creator, maintainer
API
Changelog
[Changelog][changelog-url]
License
[MIT][license-url]
*Note that all licence references and agreements mentioned in the request_id README section above
are relevant to that project's source code only.