beryl alternatives and similar shards
Based on the "HTTP" category.
Alternatively, view beryl alternatives based on common mentions on social networks and blogs.
-
halite
💎HTTP Requests Client with a chainable REST API, built-in sessions and middlewares. -
cossack
Simple and flexible HTTP client for Crystal with middleware and test support. -
Cable
It's like ActionCable (100% compatible with JS Client), but you know, for Crystal -
http-protection
This library protects against typical web attacks. It was inspired in rack-protection Ruby gem. -
crystal-routing
Extensible library to deal with http request and string based routing in Crystal -
http-params-serializable
The HTTP params parsing module for Crystal 🤓 -
http_parser.cr
Crystal wrapper for Http Parser lib: https://github.com/joyent/http-parser -
multipart.cr
Adds multipart and multipart/form-data support to the crystal standard library -
ContentDisposition
Crystal shard to create HTTP Content-Disposition headers with proper escaping/encoding of filenames -
http_distributor
http server which allows sneaky http request though it. -
crystal-cossack
Simple and flexible HTTP client for Crystal with middleware and test support.
Tired of breaking your main and manually rebasing outdated pull requests?
Do you think we are missing an alternative of beryl or a related project?
README
Beryl
Action-focused HTTP routing library for Crystal
Description
Beryl aims to be a small HTTP routing library with focus on direct mapping between route paths and their respective actions.
Both Router
and Action
design give certain flexibility for testing each
component individually.
It leverages on Crystal's HTTP library and allows you to integrate it with other middleware to build your final stack.
Installation
Add it to your project's shard.yml file:
dependencies:
beryl:
github: luislavena/beryl
Usage
The following example presents a simpler Router
that maps the root element of
a request (/
) to a specific Action
.
class Hello < Beryl::Action
def call(params)
HTTP::Response.ok "text/plain", "Hello world!"
end
end
class App < Beryl::Router
routing do
get "/", Hello
end
end
We assume you understand how to use HTTP::Server
and are comfortable with
using and building HTTP::Request
and HTTP::Response
respectively.
You can now place an instance of App
on your HTTP middleware or be the
single one handler in your stack:
server = HTTP::Server.new(8080, App.new)
server.listen
Or combine with others:
stack = [
HTTP::LogHandler.new,
App.new
]
server = HTTP::Server.new(8080, stack)
server.listen
You can see other examples in the [samples/](samples/) directory.
Radix Tree implementation
This project implement a Radix tree to perform route matching.
This has been inspired and adapted from julienschmidt/httprouter and spriet2000/vertx-http-router Go and Java implementations, respectively.
Changes to logic and optimizations have been made to take advantage of Crystal's features.
Development
- [x] HTTP Handler integration
- [x] Path/Query parameter extraction
- [x] Router/Route/Action initial design
- [ ] Nested routers (ie. resource specific mappings)
- [ ] Optional Response helpers for Action (eg. html, json)
- [ ] Optional conditional rendering (eg. stale, etag, last_modified)
Contributing
- Fork it ( https://github.com/luislavena/crystal-beryl/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Luis Lavena - creator, maintainer