Created
October 26, 2013 01:32
-
-
Save mdedetrich/7164288 to your computer and use it in GitHub Desktop.
Sample server
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
get("/") { | |
contentType="text/html" | |
jade("index") | |
} | |
// get("/:page") { | |
// findTemplate(params("page")) map { path => | |
// contentType = "text/html" | |
// jade(path) | |
// } orElse serveStaticResource() getOrElse resourceNotFound() | |
// } | |
get("/*") { | |
val query = multiParams("splat").head | |
if (query.endsWith(".js") | |
|| query.endsWith(".css") | |
|| query.endsWith(".png") | |
|| query.endsWith(".jpeg") | |
|| query.endsWith(".jpg") | |
|| query.endsWith(".gif") | |
){ | |
serveStaticResource() | |
} else { | |
contentType="text/html" | |
jade("index") | |
} | |
} | |
get("/partials/:page") { | |
contentType="text/html" | |
jade("/partials/%s.jade" format params("page"), "layout" -> "") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment