-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from rikilele/develop
v0.3.0-rc
- Loading branch information
Showing
15 changed files
with
555 additions
and
307 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -16,7 +16,7 @@ It aims to provide a similar experience to developing API servers with | |
Deployed at https://kyuko.deno.dev | ||
|
||
```ts | ||
import { Kyuko } from "https://deno.land/x/[email protected]"; | ||
import { Kyuko } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
const app = new Kyuko(); | ||
|
||
|
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,18 @@ | ||
// Copyright 2021 Riki Singh Khorana. All rights reserved. MIT license. | ||
|
||
import { Kyuko } from "../mod.ts"; | ||
|
||
const app = new Kyuko(); | ||
|
||
/** | ||
* This will handle the error thrown. | ||
*/ | ||
app.error((err, _req, res) => { | ||
res.send(err.message); | ||
}); | ||
|
||
app.get("/", (_req, _res) => { | ||
throw new Error("An intentional error occurred!"); | ||
}); | ||
|
||
app.listen(); |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { KyukoMiddleware, KyukoRequest } from "../mod.ts"; | ||
|
||
/** | ||
* Returns a `KyukoMiddleware` that decodes the values of `req.params`. | ||
*/ | ||
export function decodeParams(): KyukoMiddleware { | ||
return function (req: KyukoRequest) { | ||
Object.keys(req.params).forEach((param) => { | ||
const encoded = req.params[param]; | ||
req.params[param] = decodeURIComponent(encoded); | ||
}); | ||
}; | ||
} |
Oops, something went wrong.