forked from tanner/qotnews
parent
35e47c4049
commit
5273c6d3fe
7 changed files with 141 additions and 123 deletions
@ -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) { |
export async function get(req, res) { |
||||||
const response = await fetch(`http://localhost:33842/api/${req.params.id}`); |
const response = await fetch(`${API_URL}/api/${req.params.id}`); |
||||||
res.writeHead(200, { |
res.writeHead(response.status, { 'Content-Type': 'application/json' }); |
||||||
'Content-Type': 'application/json' |
|
||||||
}); |
|
||||||
res.end(await response.text()); |
res.end(await response.text()); |
||||||
} |
} |
@ -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) { |
export async function get(req, res) { |
||||||
const response = await fetch(`http://localhost:33842/api`); |
const response = await fetch(`${API_URL}/api`); |
||||||
res.writeHead(200, { |
res.writeHead(response.status, { 'Content-Type': 'application/json' }); |
||||||
'Content-Type': 'application/json' |
|
||||||
}); |
|
||||||
res.end(await response.text()); |
res.end(await response.text()); |
||||||
} |
} |
Loading…
Reference in new issue