initialize repo
This commit is contained in:
commit
745314c13d
1
Procfile
Normal file
1
Procfile
Normal file
@ -0,0 +1 @@
|
||||
web: java $JVM_OPTS -cp target/pronouns-standalone.jar clojure.main -m pronouns.web
|
18
project.clj
Normal file
18
project.clj
Normal file
@ -0,0 +1,18 @@
|
||||
(defproject pronouns "1.0.0-SNAPSHOT"
|
||||
:description "FIXME: write description"
|
||||
:url "http://pronouns.herokuapp.com"
|
||||
:license {:name "FIXME: choose"
|
||||
:url "http://example.com/FIXME"}
|
||||
:dependencies [[org.clojure/clojure "1.6.0"]
|
||||
[compojure "1.1.8"]
|
||||
[ring/ring-jetty-adapter "1.2.2"]
|
||||
[ring.middleware.logger "0.5.0"]
|
||||
[ring/ring-devel "1.2.2"]
|
||||
[ring-basic-authentication "1.0.5"]
|
||||
[environ "0.5.0"]
|
||||
[com.cemerick/drawbridge "0.0.6"]]
|
||||
:min-lein-version "2.0.0"
|
||||
:plugins [[environ/environ.lein "0.2.1"]]
|
||||
:hooks [environ.leiningen.hooks]
|
||||
:uberjar-name "pronouns-standalone.jar"
|
||||
:profiles {:production {:env {:production true}}})
|
21
resources/404.html
Normal file
21
resources/404.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Page Not Found</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: "Ubuntu Light", helvetica, sans-serif;
|
||||
width: 960px;
|
||||
margin: 3em auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- TODO: replace this with something that matches your app style -->
|
||||
<h1>Page Not Found</h1>
|
||||
<p>There's no page at the address you requested. If you entered it
|
||||
by hand, check for typos. If you followed a link or a bookmark,
|
||||
it may need to be updated.</p>
|
||||
</body>
|
||||
</html>
|
20
resources/500.html
Normal file
20
resources/500.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Error</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: "Ubuntu Light", helvetica, sans-serif;
|
||||
width: 960px;
|
||||
margin: 3em auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- TODO: replace this with something that matches your app style -->
|
||||
<h1>Error</h1>
|
||||
<p>Something went wrong. Try again, and if the problem persists
|
||||
please contact support.</p>
|
||||
</body>
|
||||
</html>
|
42
src/pronouns/web.clj
Normal file
42
src/pronouns/web.clj
Normal file
@ -0,0 +1,42 @@
|
||||
(ns pronouns.web
|
||||
(:require [compojure.core :refer [defroutes GET PUT POST DELETE ANY]]
|
||||
[compojure.handler :refer [site]]
|
||||
[compojure.route :as route]
|
||||
[clojure.java.io :as io]
|
||||
[ring.middleware.logger :as logger]
|
||||
[ring.middleware.stacktrace :as trace]
|
||||
[ring.middleware.session :as session]
|
||||
[ring.middleware.session.cookie :as cookie]
|
||||
[ring.adapter.jetty :as jetty]
|
||||
[environ.core :refer [env]]))
|
||||
|
||||
(def config {:server-port 5000})
|
||||
|
||||
(defroutes app-routes
|
||||
(GET "/" []
|
||||
{:status 200
|
||||
:headers {"Content-Type" "text/plain"}
|
||||
:body "a blurb explaining how to use this site"})
|
||||
(ANY "*" []
|
||||
(route/not-found (slurp (io/resource "404.html")))))
|
||||
|
||||
(defn wrap-error-page [handler]
|
||||
(fn [req]
|
||||
(try (handler req)
|
||||
(catch Exception e
|
||||
{:status 500
|
||||
:headers {"Content-Type" "text/html"}
|
||||
:body (slurp (io/resource "500.html"))}))))
|
||||
|
||||
(def app
|
||||
(-> app-routes
|
||||
; logger/wrap-with-logger
|
||||
wrap-error-page
|
||||
trace/wrap-stacktrace))
|
||||
|
||||
(defn -main []
|
||||
(jetty/run-jetty app {:port (:server-port config)}))
|
||||
|
||||
;; For interactive development:
|
||||
;; (.stop server)
|
||||
;; (def server (-main))
|
Loading…
Reference in New Issue
Block a user