add PORT back, fixes #48

This commit is contained in:
Rich Harris
2018-03-15 18:22:48 -04:00
committed by GitHub
parent 1a5f69c593
commit 99445fa62b

View File

@@ -6,6 +6,8 @@ import serve from 'serve-static';
import fetch from 'node-fetch';
import { routes } from './manifest/server.js';
const { PORT } = process.env;
// this allows us to do e.g. `fetch('/api/blog-posts')` on the server
global.fetch = (url, opts) => {
if (url[0] === '/') url = `http://localhost:${PORT}${url}`;
@@ -17,4 +19,4 @@ polka()
.use(compression({ threshold: 0 }))
.use(serve('assets'))
.use(sapper({ routes }))
.listen(process.env.PORT);
.listen(PORT);