decode req.params - fixes #417

This commit is contained in:
Rich Harris
2018-09-03 18:36:07 -04:00
parent 499b377bfd
commit 30966ee7f2
6 changed files with 63 additions and 5 deletions

View File

@@ -0,0 +1,11 @@
<h1>{slug}</h1>
<script>
export default {
preload({ params }) {
return {
slug: params.slug
};
}
};
</script>

View File

@@ -0,0 +1,15 @@
export function get(req, res) {
res.writeHead(200, {
'Content-Type': 'text/html'
});
res.end(`
<!doctype html>
<html>
<head><meta charset="utf-8"></head>
<body>
<h1>${req.params.slug}</h1>
</body>
</html>
`);
}