-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
62 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,95 @@ | ||
|
||
[](http://kemalcr.com) | ||
|
||
# Kemal | ||
|
||
Lightning Fast, Super Simple web framework. | ||
Kemal is the Fast, Effective, Simple Web Framework for the Crystal. It's perfect for building Web Applications and APIs with minimal code. | ||
|
||
[](https://github.com/kemalcr/kemal/actions/workflows/ci.yml) | ||
[](https://gitter.im/sdogruyol/kemal?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
|
||
# Super Simple β‘οΈ | ||
## Why Kemal? | ||
|
||
- π **Lightning Fast**: Built on Crystal, known for C-like performance | ||
- π‘ **Super Simple**: Minimal code needed to get started | ||
- π **Feature Rich**: Everything you need for modern web development | ||
- π§ **Flexible**: Easy to extend with middleware support | ||
|
||
## Quick Start | ||
|
||
1. First, make sure you have [Crystal installed](https://crystal-lang.org/install/). | ||
|
||
2. Add Kemal to your project's `shard.yml`: | ||
|
||
```yaml | ||
dependencies: | ||
kemal: | ||
github: kemalcr/kemal | ||
``` | ||
3. Create your first Kemal app: | ||
```ruby | ||
```crystal | ||
require "kemal" | ||
|
||
# Matches GET "http://host:port/" | ||
# Basic route - responds to GET "http://localhost:3000/" | ||
get "/" do | ||
"Hello World!" | ||
end | ||
|
||
# Creates a WebSocket handler. | ||
# Matches "ws://host:port/socket" | ||
ws "/socket" do |socket| | ||
socket.send "Hello from Kemal!" | ||
# JSON API example | ||
get "/api/status" do |env| | ||
env.response.content_type = "application/json" | ||
{"status": "ok"}.to_json | ||
end | ||
|
||
# WebSocket support | ||
ws "/chat" do |socket| | ||
socket.send "Hello from Kemal WebSocket!" | ||
end | ||
|
||
Kemal.run | ||
``` | ||
|
||
Start your application! | ||
4. Run your application: | ||
|
||
```bash | ||
crystal run src/your_app.cr | ||
``` | ||
crystal src/kemal_sample.cr | ||
``` | ||
Go to *http://localhost:3000* | ||
|
||
Check [documentation](http://kemalcr.com) or [samples](https://github.com/kemalcr/kemal/tree/master/samples) for more. | ||
5. Visit [http://localhost:3000](http://localhost:3000) - That's it! π | ||
|
||
# Installation | ||
## Key Features | ||
|
||
Add this to your application's `shard.yml`: | ||
- β **Full REST Support**: Handle all HTTP verbs (GET, POST, PUT, DELETE, etc.) | ||
- π **WebSocket Support**: Real-time bidirectional communication | ||
- π¦ **Built-in JSON Support**: Native JSON handling | ||
- ποΈ **Static File Serving**: Serve your static assets easily | ||
- π **Template Support**: Built-in ECR template engine | ||
- π **Middleware System**: Add functionality with middleware | ||
- π― **Request/Response Context**: Easy parameter and request handling | ||
|
||
## Learning Resources | ||
|
||
- π [Official Documentation](http://kemalcr.com) | ||
- π» [Sample Applications](https://github.com/kemalcr/kemal/tree/master/samples) | ||
- π [Getting Started Guide](http://kemalcr.com/guide/) | ||
- π¬ [Community Chat](https://discord.gg/prSVAZJEpz) | ||
|
||
```yaml | ||
dependencies: | ||
kemal: | ||
github: kemalcr/kemal | ||
``` | ||
|
||
See also [Getting Started](http://kemalcr.com/guide/). | ||
## Contributing | ||
|
||
# Features | ||
We love contributions! If you'd like to contribute: | ||
|
||
- Support all REST verbs | ||
- Websocket support | ||
- Request/Response context, easy parameter handling | ||
- Middleware support | ||
- Built-in JSON support | ||
- Built-in static file serving | ||
- Built-in view templating via [ECR](https://crystal-lang.org/api/ECR.html) | ||
1. Fork it (https://github.com/kemalcr/kemal/fork) | ||
2. Create your feature branch (git checkout -b my-new-feature) | ||
3. Commit your changes (git commit -am 'Add some feature') | ||
4. Push to the branch (git push origin my-new-feature) | ||
5. Create a new Pull Request | ||
|
||
# Documentation | ||
## Acknowledgments | ||
|
||
You can read the documentation at the official site [kemalcr.com](http://kemalcr.com) | ||
Special thanks to Manas for their work on [Frank](https://github.com/manastech/frank). | ||
|
||
## Thanks | ||
## License | ||
|
||
Thanks to Manas for their awesome work on [Frank](https://github.com/manastech/frank). | ||
Kemal is released under the MIT License. |