crystal-gauntlet/src/template_endpoints/index.cr

23 lines
598 B
Crystal
Raw Normal View History

2023-01-03 19:28:38 +01:00
require "ecr"
include CrystalGauntlet
2023-05-23 10:46:31 +02:00
CrystalGauntlet.template_endpoints[{
name: "tools_redirect",
path: "/tools",
methods: ["get"]
}] = ->(context : HTTP::Server::Context, params : Hash(String, String?)) {
2023-01-05 17:53:12 +01:00
context.response.headers.add("Location", "/")
context.response.status = HTTP::Status::TEMPORARY_REDIRECT
}
2023-05-23 10:46:31 +02:00
CrystalGauntlet.template_endpoints[{
name: "index",
path: "/",
methods: ["get"]
}] = ->(context : HTTP::Server::Context, params : Hash(String, String?)) {
context.response.content_type = "text/html"
ECR.embed("./public/template/index.ecr", context.response)
2023-01-03 19:28:38 +01:00
}