update sapper, tidy up

This commit is contained in:
Rich Harris
2017-12-17 15:07:21 -05:00
parent 600360665d
commit 28b3db6534
4 changed files with 3 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ const static = require('serve-static');
const { PORT = 3000 } = process.env;
// this allows us to do e.g. `fetch('/api/blog')` on the server
const fetch = require('node-fetch');
global.fetch = (url, opts) => {
if (url[0] === '/') url = `http://localhost:${PORT}${url}`;
@@ -16,9 +17,7 @@ app.use(compression({ threshold: 0 }));
app.use(static('assets'));
app.use(sapper({
selector: '#sapper'
}));
app.use(sapper());
app.listen(PORT, () => {
console.log(`listening on port ${PORT}`);