(defn app
[request]
{:status 200
:body "Hello world!"})
Go to clojurebridge.org in your web browser and view the source.
(ns global-growth.web
(:require [global-growth.core :as api]
[compojure.core :refer [defroutes GET]]
[compojure.handler :refer [site]]
[hiccup.core :as hiccup]
[hiccup.page :as page]
[hiccup.form :as form]))
Uncomment everything under the MODULE 5 line in core.clj and everything in web.clj.
(defroutes main-routes
(GET "/" [] (main-page))
(GET "/indicators" [indicator1 indicator2 year]
(view-indicators indicator1 indicator2 year)))
(hiccup/html [:header
[:h1 "Hello world!"]
[:h2 "I am an awesome subheader"]])
;;=> "<header><h1>Hello world!</h1>
;; <h2>I am an awesome subheader</h2></header>"
Take a look at main-page
.
(form/form-to {:role "form"} [:get "/indicators"]
[:div.row
[:div.form-group.col-md-5
(form/label "indicator1" "Indicator 1: ")
(form/drop-down {:class "form-control"}
"indicator1"
(api/get-indicators))]]
;; ...
(form/submit-button "Submit"))
Open project.clj
.
Make sure the following is in the project:
:ring {:handler global-growth.web/handler}
$ lein ring server
2014-04-02 21:30:06.303:INFO:oejs.Server:jetty-7.6.8.v20121106
2014-04-02 21:30:06.378:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:3000
Started server on port 3000
Go to http://localhost:3000/.