Adding /showsettings endpoint to display settings table

This commit is contained in:
Glitch (jasonsplant)
2020-04-13 17:34:37 +00:00
parent d3c7b7171a
commit 7ec5440bb5
2 changed files with 92 additions and 83 deletions

View File

@@ -72,7 +72,7 @@ app.get('/getdata', (req, res) => {
})
});
// Export all data for development
// Handle requests for /exportall by retrieving all data and returning a JSON object
app.get('/exportall', (req, res) => {
// Check that the expected key has been included with the web request
if (!req.headers['export-key'] || req.headers['export-key'] != process.env.SECRET) {
@@ -84,6 +84,13 @@ app.get('/exportall', (req, res) => {
})
})
// Handle requests for /showsettings by retrieving all settings from the database and returning a JSON object
app.get('/showsettings', (req, res) => {
db.Settings.findAll().then((result) => {
res.status(200).send(result).end();
})
})
// Handle requests to /cleanup by deleting any data older than 90 days from the datastore
app.get('/cleanup', (req, res) => {
if (!req.headers['cleanup-key'] || req.headers['cleanup-key'] != process.env.SECRET) {