make project exportable by avoiding api/blog route conflict

This commit is contained in:
Rich Harris
2018-02-05 09:09:32 -05:00
parent c4181157dd
commit c84ae160ef
4 changed files with 4 additions and 4 deletions

View File

@@ -6,7 +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
// 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}`;