mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-16 12:54:38 +00:00
Merge branch 'master' of github.com:sveltejs/sapper
This commit is contained in:
@@ -185,7 +185,8 @@ function serve({ prefix, pathname, cache_control }: {
|
|||||||
const type = lookup(req.path);
|
const type = lookup(req.path);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = read(req.path.slice(1));
|
const file = decodeURIComponent(req.path.slice(1));
|
||||||
|
const data = read(file);
|
||||||
|
|
||||||
res.setHeader('Content-Type', type);
|
res.setHeader('Content-Type', type);
|
||||||
res.setHeader('Cache-Control', cache_control);
|
res.setHeader('Cache-Control', cache_control);
|
||||||
|
|||||||
@@ -1 +1,11 @@
|
|||||||
<h1>I'm afraid I just blue myself</h1>
|
<h1>{phrase}</h1>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
preload() {
|
||||||
|
return this.fetch('fünke.json').then(r => r.json()).then(phrase => {
|
||||||
|
return { phrase };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
9
test/app/routes/fünke.json.js
Normal file
9
test/app/routes/fünke.json.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export function get(req, res) {
|
||||||
|
res.writeHead(200, {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
});
|
||||||
|
|
||||||
|
res.end(JSON.stringify(
|
||||||
|
"I'm afraid I just blue myself"
|
||||||
|
));
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user