qleex
Version, currently master branch1 version
- master branchlatestApr 20, 2019
github.com/shellbear/qleex
A minimal HTTP Middleware router for Crystal.
1 stars
0 dependents
License: not declared
Installation
# Add this to your shard.yml
dependencies:
qleex:
github: shellbear/qleex
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.28.0- Author
- Shellbear
- Target
qleexfrom src/qleex.cr
Dependencies
Runtime Dependencies
- radix*github: luislavena/radix
README
Qleex
A minimal HTTP Middleware router for Crystal.
Installation
Add this to your application's shard.yml:
dependencies:
qleex:
github: ShellBear/qleex
Usage
require "http/server"
require "qleex"
router = Qleex::Router.new
# You can define one or more paths for get, post, put, delete, patch and options HTTP methods
router.get("/hello", -> (context : Qleex::Context, params : Qleex::Parameters) {
context.response.content_type = "text/plain"
context.response.print "Hello world!"
})
router.post("/post", -> (context : Qleex::Context, params : Qleex::Parameters) {
context.response.content_type = "text/plain"
context.response.print "This is POST request"
})
# You can define multiple methods for one or more paths.
router.route(["GET", "POST"], "/ping", -> (context : Qleex::Context, params : Qleex::Parameters) {
context.response.content_type = "text/plain"
context.response.print "pong"
})
# You can define multiple paths for one or more methods.
router.route("GET", ["/ex1", "/ex2", "/ex3"], -> (context : Qleex::Context, params : Qleex::Parameters) {
context.response.content_type = "text/plain"
context.response.print "You matched one of these URLs: [/ex1, /ex2, /ex3]"
})
# You can add parameters to the path by using the ":" character
router.route("GET", "/user/:id", -> (context : Qleex::Context, params : Qleex::Parameters) {
context.response.content_type = "text/plain"
context.response.print "User #{params["id"]}"
})
# You can use a wildcard to match everything
router.route("GET", "/*", -> (context : Qleex::Context, params : Qleex::Parameters) {
context.response.content_type = "text/plain"
context.response.print "Wow"
})
server = HTTP::Server.new(router)
address = server.bind_tcp 8080
puts "Listening on http://#{address}"
server.listen
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Apr 20, 2019
- Crystal
0.28.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/shellbear/qleex
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 17, 2026
- Synced
- Aug 17, 2026
- Versions
- 1