mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-14 11:14:39 +00:00
make project exportable by avoiding api/blog route conflict
This commit is contained in:
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user