This commit is contained in:
Jason Schwarzenberger
2020-11-27 17:31:51 +13:00
parent 35e47c4049
commit 5273c6d3fe
7 changed files with 141 additions and 123 deletions

View File

@@ -1,9 +1,9 @@
import fetch from 'node-fetch';
import fetch from 'isomorphic-fetch';
const API_URL = process.env.API_URL || 'http://news.1j.nz';
export async function get(req, res) {
const response = await fetch(`http://localhost:33842/api`);
res.writeHead(200, {
'Content-Type': 'application/json'
});
const response = await fetch(`${API_URL}/api`);
res.writeHead(response.status, { 'Content-Type': 'application/json' });
res.end(await response.text());
}