From 5359781a64a4baaa93064cfd919ca8d82ff3a9fe Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol <990485+sdogruyol@users.noreply.github.com> Date: Mon, 13 Jan 2025 13:03:29 +0300 Subject: [PATCH] Improve README --- README.md | 96 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index e0ab8ca1..7da45e2a 100644 --- a/README.md +++ b/README.md @@ -1,67 +1,95 @@ - [![Kemal](https://avatars3.githubusercontent.com/u/15321198?v=3&s=200)](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. [![CI](https://github.com/kemalcr/kemal/actions/workflows/ci.yml/badge.svg)](https://github.com/kemalcr/kemal/actions/workflows/ci.yml) [![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) -# 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.