https://github.com/tailrecursion/boot.ring
Tasks to start ring servers in the Boot build tool
https://github.com/tailrecursion/boot.ring
Last synced: 5 months ago
JSON representation
Tasks to start ring servers in the Boot build tool
- Host: GitHub
- URL: https://github.com/tailrecursion/boot.ring
- Owner: tailrecursion
- License: epl-1.0
- Created: 2014-02-15T19:41:51.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-06-05T19:06:59.000Z (about 12 years ago)
- Last Synced: 2025-12-29T20:36:12.760Z (6 months ago)
- Language: Clojure
- Size: 256 KB
- Stars: 5
- Watchers: 10
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# boot.ring
This project contains a number of tasks for the [boot][2] Clojure build tool
that can be used to construct [Ring][4] servers for development.
### Dependency
Artifacts are published on Clojars.
[![latest version][3]][1]
### Tasks
| Task | Description |
|----------------|-------------------------------------------------------------|
| cors | Middleware to handle cross-origin requests. |
| files | Middleware to serve static files. |
| head | Middleware to handle HEAD requests. |
| session-cookie | Middleware to manage client sessions via cookies. |
| dev-mode | Middleware to add the "X-Dev-Mode" header to responses. |
| jetty | Start a Jetty server with composition of middleware. |
| reload | Automatically reload namespaces during development. |
| dev-server | The "kitchen sink" task to start a dev server. |
For more info about a task do `boot [help ]`.
### Usage
```clojure
#!/usr/bin/env boot
;; build.boot file
#tailrecursion.boot.core/version "..."
(set-env!
:project ...
:version ...
:dependencies [[tailrecursion/boot.ring "..."] ...]
...)
(require '[tailrecursion.boot.task.ring :as r] ...)
;; Ring tasks can be composed to create the server you desire:
(deftask my-server
[]
(comp (r/head) (r/dev-mode) (r/files) (r/jetty)))
(defn wrap-foo [handler]
(fn [req]
;; ...
(handle req)))
;; You can create your own middleware task to insert your middleware:
(deftask my-middleware
[]
(r/ring-task wrap-foo))
;; And use your task, composing it with other ring tasks:
(deftask my-other-server
[]
(comp (head) (dev-mode) (my-middleware) (files) (jetty)))
```
## License
Copyright © 2013 Alan Dipert and Micha Niskin
Distributed under the Eclipse Public License, the same as Clojure.
[1]: https://clojars.org/tailrecursion/boot.ring
[2]: https://github.com/tailrecursion/boot
[3]: https://clojars.org/tailrecursion/boot.ring/latest-version.svg?cachebust=2
[4]: https://github.com/ring-clojure/ring