Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbb9423
commit 0e26621
Showing
3 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,30 @@ | ||
(ns skillz.core | ||
(:require [ring.adapter.jetty :as jetty]) | ||
(:require | ||
[ring.adapter.jetty :as jetty] | ||
[ring.middleware.reload :refer [wrap-reload]] | ||
[yesql.core :refer [defqueries]] | ||
[compojure.core :refer :all] | ||
[compojure.route :as route]) | ||
(:gen-class)) | ||
|
||
(def db (or (System/getenv "DATABASE_URL") | ||
"jdbc:postgresql://localhost/skillz")) | ||
|
||
(defqueries "skillz/setup.sql") | ||
|
||
(defroutes app | ||
(GET "/" [] "This is the homepage.") | ||
(GET "/skills/new" [] "")) | ||
|
||
(defn -main | ||
"I don't do a whole lot ... yet." | ||
[& args] | ||
(jetty/run-jetty (fn [req] {:status 200 :body "OK" :headers {}}) | ||
{:port (Long. (System/getenv "PORT"))})) | ||
(create-skill-table! db) | ||
(jetty/run-jetty | ||
app | ||
{:port (Long. (System/getenv "PORT"))})) | ||
|
||
(defn dev-main | ||
[& args] | ||
(jetty/run-jetty | ||
(wrap-reload #'app) | ||
{:port (Long. (System/getenv "PORT"))})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- name: create-skill-table! | ||
-- Creates the table for all of the skills. | ||
CREATE TABLE IF NOT EXISTS skills ( | ||
id BIGSERIAL PRIMARY KEY, | ||
name TEXT NOT NULL | ||
) | ||
|
||
|