init
This commit is contained in:
commit
2984b4911e
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/target
|
||||
/lib
|
||||
/classes
|
||||
/checkouts
|
||||
pom.xml
|
||||
pom.xml.asc
|
||||
*.jar
|
||||
*.class
|
||||
/.lein-*
|
||||
/.nrepl-port
|
19
README.md
Normal file
19
README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# clojsa
|
||||
|
||||
FIXME
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You will need [Leiningen][] 2.0.0 or above installed.
|
||||
|
||||
[leiningen]: https://github.com/technomancy/leiningen
|
||||
|
||||
## Running
|
||||
|
||||
To start a web server for the application, run:
|
||||
|
||||
lein ring server
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2020 FIXME
|
12
project.clj
Normal file
12
project.clj
Normal file
@ -0,0 +1,12 @@
|
||||
(defproject clojsa "0.1.0-SNAPSHOT"
|
||||
:description "FIXME: write description"
|
||||
:url "http://example.com/FIXME"
|
||||
:min-lein-version "2.0.0"
|
||||
:dependencies [[org.clojure/clojure "1.10.0"]
|
||||
[compojure "1.6.1"]
|
||||
[ring/ring-defaults "0.3.2"]]
|
||||
:plugins [[lein-ring "0.12.5"]]
|
||||
:ring {:handler clojsa.handler/app}
|
||||
:profiles
|
||||
{:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
|
||||
[ring/ring-mock "0.3.2"]]}})
|
11
src/clojsa/handler.clj
Normal file
11
src/clojsa/handler.clj
Normal file
@ -0,0 +1,11 @@
|
||||
(ns clojsa.handler
|
||||
(:require [compojure.core :refer :all]
|
||||
[compojure.route :as route]
|
||||
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]))
|
||||
|
||||
(defroutes app-routes
|
||||
(GET "/" [] "Hello World")
|
||||
(route/not-found "Not Found"))
|
||||
|
||||
(def app
|
||||
(wrap-defaults app-routes site-defaults))
|
14
test/clojsa/handler_test.clj
Normal file
14
test/clojsa/handler_test.clj
Normal file
@ -0,0 +1,14 @@
|
||||
(ns clojsa.handler-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[ring.mock.request :as mock]
|
||||
[clojsa.handler :refer :all]))
|
||||
|
||||
(deftest test-app
|
||||
(testing "main route"
|
||||
(let [response (app (mock/request :get "/"))]
|
||||
(is (= (:status response) 200))
|
||||
(is (= (:body response) "Hello World"))))
|
||||
|
||||
(testing "not-found route"
|
||||
(let [response (app (mock/request :get "/invalid"))]
|
||||
(is (= (:status response) 404)))))
|
Loading…
Reference in New Issue
Block a user