Fix up minor issues
This commit is contained in:
parent
565b56888d
commit
8a9cca8335
27
server.js
27
server.js
@ -366,7 +366,6 @@ function CreateDynamicEndpoints() {
|
||||
})
|
||||
|
||||
app.post("/"+endpoint.endpoint,async(req,res)=>{
|
||||
|
||||
var allExist=true
|
||||
endpoint.requiredfields.forEach((field)=>{
|
||||
if (!(field in req.body)) {
|
||||
@ -570,6 +569,32 @@ app.get('/test/data',async(req,res)=>{
|
||||
res.status(200).json(finalresult)
|
||||
})
|
||||
|
||||
app.get('/dataid',async(req,res)=>{
|
||||
var finalresult = {}
|
||||
var promises = []
|
||||
for (var endpoint of ENDPOINTDATA) {
|
||||
await db.query('select * from '+endpoint.endpoint+' order by id asc')
|
||||
.then((data)=>{
|
||||
finalresult[endpoint.endpoint]={}
|
||||
data.rows.forEach((val)=>{finalresult[endpoint.endpoint][val.id]=val})
|
||||
})
|
||||
}
|
||||
res.status(200).json(finalresult)
|
||||
})
|
||||
|
||||
app.get('/test/dataid',async(req,res)=>{
|
||||
var finalresult = {}
|
||||
var promises = []
|
||||
for (var endpoint of ENDPOINTDATA) {
|
||||
await db2.query('select * from '+endpoint.endpoint+' order by id asc')
|
||||
.then((data)=>{
|
||||
finalresult[endpoint.endpoint]={}
|
||||
data.rows.forEach((val)=>{finalresult[endpoint.endpoint][val.id]=val})
|
||||
})
|
||||
}
|
||||
res.status(200).json(finalresult)
|
||||
})
|
||||
|
||||
//Generates our table schema:
|
||||
ENDPOINTDATA.forEach((endpoint)=>{
|
||||
console.log(endpoint.endpoint+":\n\t"+endpoint.requiredfields.join('\t')+(endpoint.optionalfields.length>0?"\t":"")+endpoint.optionalfields.join("\t"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user