Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SuperPaintman/response-time
Response time for Crystal servers.
https://github.com/SuperPaintman/response-time
kemal middleware response-time
Last synced: about 1 month ago
JSON representation
Response time for Crystal servers.
- Host: GitHub
- URL: https://github.com/SuperPaintman/response-time
- Owner: SuperPaintman
- License: mit
- Created: 2016-11-18T09:01:18.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-16T15:05:53.000Z (almost 8 years ago)
- Last Synced: 2024-08-01T17:35:32.410Z (4 months ago)
- Topics: kemal, middleware, response-time
- Language: Crystal
- Homepage: https://superpaintman.github.io/response-time/
- Size: 8.79 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crystal - response_time - Response time for Crystal servers (pure http server, kemal, etc.) (Framework Components)
- awesome-crystal - response_time - Response time for Crystal servers (pure http server, kemal, etc.) (Framework Components)
README
# response\_time
[![Linux Build][travis-image]][travis-url]
[![Shards version][shards-image]][shards-url]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`:
```yaml
dependencies:
response_time:
github: SuperPaintman/response-time
```--------------------------------------------------------------------------------
## Usage
### With pure Crystal server```crystal
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!"
endserver.listen
```### With Kemal
```crystal
require "response_time"
require "kemal"add_handler ResponseTime::Handler.new
get "/" do |env|
"Hello response time!"
endKemal.run
```--------------------------------------------------------------------------------
## Test
```sh
crystal spec
```--------------------------------------------------------------------------------
## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b feature/`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin feature/`)
5. Create a new Pull Request--------------------------------------------------------------------------------
## Contributors
- [SuperPaintman](https://github.com/SuperPaintman) SuperPaintman - creator, maintainer
--------------------------------------------------------------------------------
## API
[Docs][docs-url]--------------------------------------------------------------------------------
## Changelog
[Changelog][changelog-url]--------------------------------------------------------------------------------
## License
[MIT][license-url]
[license-url]: LICENSE
[changelog-url]: CHANGELOG.md
[docs-url]: https://superpaintman.github.io/response-time/
[travis-image]: https://img.shields.io/travis/SuperPaintman/response-time/master.svg?label=linux
[travis-url]: https://travis-ci.org/SuperPaintman/response-time
[shards-image]: https://img.shields.io/github/tag/superpaintman/response-time.svg?label=shards
[shards-url]: https://github.com/superpaintman/response-time