replace api/settings and customizatons with secure REST calls #501

This commit is contained in:
Proddy
2022-05-16 21:30:06 +02:00
parent ae9af3bf0b
commit fc29a3ad95
9 changed files with 110 additions and 57 deletions

View File

@@ -1193,16 +1193,19 @@ rest_server.get(SYSTEM_INFO_ENDPOINT, (req, res) => {
res.json(emsesp_info)
})
const SYSTEM_SETTINGS_ENDPOINT = API_ENDPOINT_ROOT + 'system/settings'
rest_server.post(SYSTEM_SETTINGS_ENDPOINT, (req, res) => {
console.log('System Settings POST: ' + JSON.stringify(req.body))
res.sendStatus(200)
})
rest_server.get(SYSTEM_SETTINGS_ENDPOINT, (req, res) => {
console.log('System Settings GET')
const GET_SETTINGS_ENDPOINT = REST_ENDPOINT_ROOT + 'getSettings'
rest_server.get(GET_SETTINGS_ENDPOINT, (req, res) => {
console.log('System Settings:')
res.json(settings)
})
const GET_CUSTOMIZATIONS_ENDPOINT = REST_ENDPOINT_ROOT + 'getCustomizations'
rest_server.get(GET_CUSTOMIZATIONS_ENDPOINT, (req, res) => {
console.log('Customizations:')
// not implemented yet
res.sendStatus(200)
})
// start server
const expressServer = rest_server.listen(port, () =>
console.log(`Mock server for EMS-ESP is up and running at http://localhost:${port}`),