shard-kemal/README.md

66 lines
1.9 KiB
Markdown
Raw Normal View History

2015-10-28 18:56:39 +00:00
<img src="https://avatars3.githubusercontent.com/u/15321198?v=3&s=200" width="100" height="100" />
2015-11-22 09:41:21 +00:00
# Kemal [![Build Status](https://travis-ci.org/sdogruyol/kemal.svg?branch=master)](https://travis-ci.org/sdogruyol/kemal)
2015-06-01 21:06:26 +00:00
2015-12-05 21:14:12 +00:00
[![Join the chat at https://gitter.im/sdogruyol/kemal](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sdogruyol/kemal?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2015-10-27 05:08:15 +00:00
Lightning Fast, Super Simple web framework for [Crystal](http://www.crystal-lang.org).
Inspired by [Sinatra](http://www.sinatrarb.com/) but with superior performance and built-in WebSocket support.
2015-10-23 18:44:41 +00:00
# Super Simple ⚡️
2015-10-23 19:43:33 +00:00
```ruby
2015-10-24 13:48:47 +00:00
require "kemal"
# Matches GET "http://host:port/"
2015-10-23 19:43:33 +00:00
get "/" do
"Hello World!"
end
# Creates a WebSocket handler.
# Matches "ws://host:port/socket"
ws "/socket" do |socket|
socket.send "Hello from Kemal!"
end
2016-03-19 13:37:33 +00:00
Kemal.run
2015-10-23 19:43:33 +00:00
```
2016-03-19 13:37:33 +00:00
Start your application!
2015-10-24 16:20:49 +00:00
```
2016-03-19 13:37:33 +00:00
crystal src/kemal_sample.cr
2015-10-24 16:20:49 +00:00
```
2015-10-23 19:43:33 +00:00
Go to *http://localhost:3000*
2016-02-06 13:30:10 +00:00
Check [documentation](http://kemalcr.com) or [samples](https://github.com/sdogruyol/kemal/tree/master/samples) for more.
2015-10-24 13:50:26 +00:00
# Super Fast 🚀
2015-11-09 18:57:54 +00:00
Numbers speak louder than words.
| Framework | Request Per Second | Avg. Response Time |
2016-01-25 08:50:54 +00:00
| --------------------- | :-----------------: | -----------------: |
| Kemal (Production) | 100238 | 395.44μs |
| Sinatra (Thin) | 2274 | 43.82ms |
2015-11-09 18:57:54 +00:00
2015-11-17 19:53:33 +00:00
These results were achieved with ```wrk``` on a Macbook Pro Late 2013. (**2Ghz i7 8GB Ram OS X Yosemite**)
2015-12-16 18:32:01 +00:00
# Features
2015-10-23 18:50:19 +00:00
2015-12-16 18:32:01 +00:00
- Support all REST verbs
- Websocket support
- Request/Response context, easy parameter handling
- Middlewares
- Built-in JSON support
- Built-in static file serving
2016-02-20 21:50:13 +00:00
- Built-in view templating via [Kilt](https://github.com/jeromegn/kilt)
2015-12-16 18:34:30 +00:00
# Documentation
2016-02-06 13:30:10 +00:00
You can read the documentation at the official site [kemalcr.com](http://kemalcr.com)
2015-12-16 18:34:30 +00:00
2015-10-23 19:51:39 +00:00
## Thanks
Thanks to Manas for their awesome work on [Frank](https://github.com/manastech/frank).