parent
508c7aa1f5
commit
f3a2a9355e
4 changed files with 35 additions and 0 deletions
@ -0,0 +1,23 @@ |
||||
import { RequestHandler } from 'express'; |
||||
|
||||
import { getAnvilData } from '../../accessModule'; |
||||
import { stderr } from '../../shell'; |
||||
|
||||
export const getUPSTemplate: RequestHandler = (request, response) => { |
||||
let rawUPSData; |
||||
|
||||
try { |
||||
({ ups_data: rawUPSData } = getAnvilData<{ ups_data: AnvilDataUPSHash }>( |
||||
{ ups_data: true }, |
||||
{ predata: [['Striker->get_ups_data']] }, |
||||
)); |
||||
} catch (subError) { |
||||
stderr(`Failed to get ups template; CAUSE: ${subError}`); |
||||
|
||||
response.status(500).send(); |
||||
|
||||
return; |
||||
} |
||||
|
||||
response.status(200).send(rawUPSData); |
||||
}; |
@ -0,0 +1 @@ |
||||
export * from './getUPSTemplate'; |
@ -0,0 +1,9 @@ |
||||
import express from 'express'; |
||||
|
||||
import { getUPSTemplate } from '../lib/request_handlers/ups'; |
||||
|
||||
const router = express.Router(); |
||||
|
||||
router.get('/template', getUPSTemplate); |
||||
|
||||
export default router; |
Loading…
Reference in new issue