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
2016-01-08 17:11:59 +00:00
Kemal is under heavy development and currently supports Crystal latest.
2015-10-23 18:50:19 +00:00
2015-10-23 19:43:33 +00:00
# Super Simple <3
```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
2015-10-23 19:43:33 +00:00
```
2015-10-24 16:20:49 +00:00
Build and run!
```
2015-12-16 18:32:01 +00:00
crystal run 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-01-11 17:16:44 +00:00
Check [documentation](https://kemalcr.com) or [samples](https://github.com/sdogruyol/kemal/tree/master/samples) for more.
2015-10-24 13:50:26 +00:00
2015-11-09 18:57:54 +00:00
# Super Fast <3
Numbers speak louder than words.
| Framework | Request Per Second | Avg. Response Time |
| :------------ |:---------------:| -----:|
2015-11-19 18:20:51 +00:00
| Kemal (Production) | 64986 | 170μs |
2015-11-09 18:57:54 +00:00
| Sinatra (Thin) | 2274 | 43.82ms |
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
- Built-in view templating via ecr
2015-12-16 18:34:30 +00:00
# Documentation
2016-01-11 17:16:44 +00:00
You can read the documentation at the official site [kemalcr.com](https://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).