Last active
May 9, 2016 07:58
-
-
Save avescodes/9980543 to your computer and use it in GitHub Desktop.
Minimal Pedestal service without default interceptors or dev tooling machinery. Automatically reloads changes.
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
(ns my-todo.core | |
(:require [io.pedestal.http :as http] | |
[io.pedestal.http.route :refer [router]] | |
[io.pedestal.http.route.definition :refer [defroutes]])) | |
(defn hello-world [context] | |
{:status 200 | |
:body "Hello, world!" | |
:headers {}}) | |
(defroutes routes | |
[[["/" {:get hello-world}]]]) | |
(def service {::http/interceptors [(router (fn [] | |
(require 'my-todo.core :reload) | |
routes))] | |
::http/port 8080}) | |
(defn -main [& args] | |
(-> service | |
http/create-server | |
http/start)) |
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
<!-- Simple Logback configuration for STDOUT-only | |
Place in resources/logback.xml to quiet down logging output --> | |
<configuration scan="true" scanPeriod="10 seconds"> | |
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder --> | |
<encoder> | |
<pattern>%-5level %logger{36} - %msg%n</pattern> | |
</encoder> | |
<!-- Only log level INFO and above --> | |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |
<level>INFO</level> | |
</filter> | |
</appender> | |
<root level="INFO"> | |
<appender-ref ref="STDOUT" /> | |
</root> | |
<!-- For loggers in the these namespaces, log at all levels. --> | |
<logger name="user" level="ALL" /> | |
<logger name="io.pedestal" level="ALL" /> | |
</configuration> |
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
(defproject my-todo "0.1.0-SNAPSHOT" | |
:dependencies [[org.clojure/clojure "1.6.0"] | |
[io.pedestal/pedestal.service "0.3.0-SNAPSHOT"] | |
[io.pedestal/pedestal.service-tools "0.3.0-SNAPSHOT"] | |
[io.pedestal/pedestal.jetty "0.3.0-SNAPSHOT"]] | |
:main my-todo.core) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment