tverkettider/endpoint_handlers/licenseinfo.js

26 lines
792 B
JavaScript
Raw Normal View History

2023-04-29 13:59:36 +02:00
const LICENCEINFO_ENDPOINT = 'https://fp.trafikverket.se/Boka/licence-information'
async function getLicenceInfo(req, res) {
// Check for the required parameters
let response = await fetch(LICENCEINFO_ENDPOINT, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36'
},
// body: JSON.stringify({
// licenceId: licenceId,
// }),
})
if (!response.ok) {
res.status(500).json({ message: 'Something went wrong' });
return;
}
let json = await response.json()
// console.log(json)
res.json(json)
}
module.exports = getLicenceInfo;