initial commit

This commit is contained in:
Rich Harris
2017-12-17 14:47:18 -05:00
commit 600360665d
27 changed files with 893 additions and 0 deletions

25
server.js Normal file
View File

@@ -0,0 +1,25 @@
const fs = require('fs');
const app = require('express')();
const compression = require('compression');
const sapper = require('sapper');
const static = require('serve-static');
const { PORT = 3000 } = process.env;
const fetch = require('node-fetch');
global.fetch = (url, opts) => {
if (url[0] === '/') url = `http://localhost:${PORT}${url}`;
return fetch(url, opts);
};
app.use(compression({ threshold: 0 }));
app.use(static('assets'));
app.use(sapper({
selector: '#sapper'
}));
app.listen(PORT, () => {
console.log(`listening on port ${PORT}`);
});