mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-20 13:35:11 +00:00
add PORT back, fixes #48
This commit is contained in:
@@ -6,6 +6,8 @@ import serve from 'serve-static';
|
|||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { routes } from './manifest/server.js';
|
import { routes } from './manifest/server.js';
|
||||||
|
|
||||||
|
const { PORT } = process.env;
|
||||||
|
|
||||||
// this allows us to do e.g. `fetch('/api/blog-posts')` on the server
|
// this allows us to do e.g. `fetch('/api/blog-posts')` on the server
|
||||||
global.fetch = (url, opts) => {
|
global.fetch = (url, opts) => {
|
||||||
if (url[0] === '/') url = `http://localhost:${PORT}${url}`;
|
if (url[0] === '/') url = `http://localhost:${PORT}${url}`;
|
||||||
@@ -17,4 +19,4 @@ polka()
|
|||||||
.use(compression({ threshold: 0 }))
|
.use(compression({ threshold: 0 }))
|
||||||
.use(serve('assets'))
|
.use(serve('assets'))
|
||||||
.use(sapper({ routes }))
|
.use(sapper({ routes }))
|
||||||
.listen(process.env.PORT);
|
.listen(PORT);
|
||||||
|
|||||||
Reference in New Issue
Block a user