forked from swlkr/janetdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.janet
31 lines (25 loc) · 950 Bytes
/
main.janet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(import joy :prefix "")
(import ./helpers :prefix "")
(defroutes routes
[:get "/" :home/index]
[:delete "/sessions" :sessions/destroy]
[:get "/github-auth" :home/github-auth]
[:post "/searches" :home/searches]
[:get "/bindings/random" :examples/random]
[:get "/bindings/:binding-id/examples/form" :examples/form]
[:get "/bindings/:binding-id/examples/new" :examples/new]
[:post "/bindings/:binding-id/examples" :examples/create]
[:get "/examples/:id/edit" :examples/edit]
[:patch "/examples/:id" :examples/patch]
[:delete "/examples/:id" :examples/destroy]
[:get "/export.json" :examples/export]
[:get "/playground/example/:id" :playground/example]
[:get "/playground" :playground/home]
[:get "/*" :bindings/show])
(def app (app {:routes routes
:layout layout
:404 /404}))
(defn main [& args]
(db/connect (env :database-url))
(server app (env :port) "0.0.0.0")
(db/disconnect))