response-time

Response time for Crystal servers.

response_time

Linux Build Shards version

Response time for Crystal servers.

This module set response HTTP Header like this:

X-Response-Time: 0.0722ms

Installation

Add this to your application's shard.yml:

dependencies:
  response_time:
    github: SuperPaintman/response-time

Usage

With pure Crystal server

require "response_time"
require "http/server"

server = HTTP::Server.new("0.0.0.0", 8080,
  [
    ResponseTime::Handler.new
  ]) do |context|
  context.response.content_type = "text/plain"
  context.response.print "Hello response time!"
end

server.listen

With Kemal

require "response_time"
require "kemal"

add_handler ResponseTime::Handler.new

get "/" do |env|
  "Hello response time!"
end

Kemal.run

Test

crystal spec

Contributing

  1. Fork it (https://github.com/SuperPaintman/response-time/fork)
  2. Create your feature branch (git checkout -b feature/<feature_name>)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin feature/<feature_name>)
  5. Create a new Pull Request

Contributors


API

Docs


Changelog

Changelog


License

MIT

Repository

response-time

Owner
Statistic
  • 8
  • 0
  • 1
  • 0
  • 0
  • over 7 years ago
  • November 18, 2016
License

MIT License

Links
Synced at

Thu, 07 Nov 2024 01:17:39 GMT

Languages