Merge branch 'master' of github.com:sveltejs/sapper

This commit is contained in:
Rich Harris
2018-09-03 07:54:42 -04:00
3 changed files with 22 additions and 2 deletions

View File

@@ -185,7 +185,8 @@ function serve({ prefix, pathname, cache_control }: {
const type = lookup(req.path);
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('Cache-Control', cache_control);

View File

@@ -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>

View 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"
));
}