Skip to content

Instantly share code, notes, and snippets.

@jokimaki
Last active October 28, 2015 06:33
Show Gist options
  • Save jokimaki/aaeffe14048a87a7238d to your computer and use it in GitHub Desktop.
Save jokimaki/aaeffe14048a87a7238d to your computer and use it in GitHub Desktop.
ClojureBridge/global-growth modifications
(ns clojurebridge.core
(:require [clojure.edn :as edn]
[clj-http.client :as client]
[cheshire.core :as json]))
:dependencies [[org.clojure/clojure "1.7.0"]
[clj-http "2.0.0"]
[cheshire "5.5.0"]
[ring "1.4.0"]
[ring/ring-json "0.4.0"]
[ring/ring-defaults "0.1.5"]
[compojure "1.4.0"]
[hiccup "1.0.5"]]
(ns clojurebridge.web
(:require [ring.adapter.jetty :as jetty]
[ring.middleware.defaults :refer :all]
[ring.util.response :as response]
[ring.middleware.json :refer [wrap-json-response]]
[clojurebridge.core :as api]
[compojure.core :refer [defroutes GET]]
[compojure.handler :refer [site]]
[hiccup.core :as hiccup]
[hiccup.page :as page]
[hiccup.form :as form]))
;;; ...
;;; Ennen main-routesia
(defn json-content [data]
(-> data response/response (response/content-type "application/json")))
;;; Tiedoston loppuun:
(def app (-> main-routes
(wrap-defaults site-defaults)
wrap-json-response))
(defonce server (atom nil))
(defn stop! []
(swap! server #(.stop %)))
(defn -main [& args]
(if-not @server
(reset! server (jetty/run-jetty #'app {:port 3000 :join? false}))
(println "Already started")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment