mirror of
https://github.com/uetchy/namae.git
synced 2025-03-18 04:50:32 +09:00
15 lines
326 B
JavaScript
15 lines
326 B
JavaScript
const fetch = require('isomorphic-unfetch')
|
|
|
|
exports.fetch = (url, method = 'HEAD') => {
|
|
return fetch(url, { method })
|
|
}
|
|
|
|
exports.send = (res, data) => {
|
|
res.setHeader('Cache-Control', 'maxage=0, s-maxage=43200')
|
|
res.json(data)
|
|
}
|
|
|
|
exports.sendError = (res, error) => {
|
|
res.status(400).json({ error: error.message })
|
|
}
|