example error pages

This commit is contained in:
Rich Harris
2018-02-17 18:39:46 -05:00
parent 1f9b212794
commit ad0da849fb
6 changed files with 98 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ import express from 'express';
import compression from 'compression';
import sapper from 'sapper';
import serve from 'serve-static';
import fetch from 'node-fetch';
import { routes } from './manifest/server.js';
const app = express();
@@ -10,7 +11,6 @@ const app = express();
const { PORT = 3000 } = process.env;
// this allows us to do e.g. `fetch('/api/blog-posts')` on the server
const fetch = require('node-fetch');
global.fetch = (url, opts) => {
if (url[0] === '/') url = `http://localhost:${PORT}${url}`;
return fetch(url, opts);