Last active
May 14, 2020 08:39
-
-
Save urcoilbisurco/ee424f2664ff0768bfcfab99e5d6bd61 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import { | |
app, | |
get, | |
post, | |
redirect, | |
contentType, | |
} from "https://denopkg.com/syumai/[email protected]/mod.ts"; | |
app( | |
get("/hello", () => "hello"), | |
get("/hello/:id", ({ params }) => params.id), | |
get( | |
"/hello/:id/and/:name", | |
({ params }) => `:id is ${params.id}, :name is ${params.name}`, | |
), | |
get("/error", () => [500, "an error has occured"]), | |
get("/callName", ({ params }) => `Hi, ${params.name}!`), | |
post("/callName", ({ params }) => `Hi, ${params.name}!`), | |
get("/foo", () => redirect("/hello", 302)), // redirect from /foo to /hello | |
get("/info", () => [ | |
200, | |
contentType("json"), | |
JSON.stringify({ app: "dinatra", version: "0.0.1" }), | |
]), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment