https://github.com/xafizoff/compojurescript
Compojure for ClojureScript
https://github.com/xafizoff/compojurescript
clojure clojurescript compojure
Last synced: 3 months ago
JSON representation
Compojure for ClojureScript
- Host: GitHub
- URL: https://github.com/xafizoff/compojurescript
- Owner: xafizoff
- License: epl-1.0
- Created: 2018-04-08T16:49:45.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-13T20:57:46.000Z (about 7 years ago)
- Last Synced: 2025-01-16T20:57:06.054Z (4 months ago)
- Topics: clojure, clojurescript, compojure
- Language: Clojure
- Homepage:
- Size: 37.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# CompojureScript
[Compojure] for ClojureScript. Works both in the node.js environment and in browsers
[](https://travis-ci.org/xafizoff/compojurescript)
[](https://clojars.org/compojurescript)## Usage
```clojure
[compojurescript "0.1.1"]```
### Node.js with [macchiato-framework]
```clojure
(ns hello-world.core
(:require [compojurescript.core :refer-macros [defroutes GET]]
[macchiato.util.response :refer [not-found]]))(defroutes app
(GET "/" [] "Hello World
")
(not-found "Page not found
"))
```### SPA with [accountant]
```clojure
(defroutes app-routes
(ANY "/" [] {:page :home})
(ANY "/ext" [] nil) ;external link, not handled by accountant
{:page :not-found})(defn navigate! [path]
(if-let [{:keys [page params]} (app-routes {:uri path})]
; draw your page
))(accountant/configure-navigation! {:nav-handler navigate!
:path-exists? #(app-routes {:uri %})})
```See [Compojure] docs for advanced usage
## License
Copyright © 2018 Marat Khafizov, James Reeves
Distributed under the Eclipse Public License version 1.0
[Compojure]: https://github.com/weavejester/compojure
[macchiato-framework]: https://github.com/macchiato-framework
[accountant]: https://github.com/venantius/accountant