blah express update
This commit is contained in:
parent
7c53b362eb
commit
6fcf603603
@ -6,13 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = 3000;
|
const port = 80;
|
||||||
|
|
||||||
const testRoute = require("../routes/test.js")
|
const testRoute = require("../routes/test.js")
|
||||||
const testRoute1 = require("../routes/latest-Data.js")
|
const latestDataroute = require("../routes/latest-Data.js")
|
||||||
|
|
||||||
app.use('/test', testRoute);
|
app.use('/test', testRoute);
|
||||||
app.use('/api/latest-data', testRoute1);
|
app.use('/api/latest-data', latestDataroute);
|
||||||
|
|
||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
|
@ -13,7 +13,7 @@ async function getLatestData() {
|
|||||||
return latestData;
|
return latestData;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error('Error:', error);
|
console.error(error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ router.get('/', async (req, res) => {
|
|||||||
res.status(200).send(data);
|
res.status(200).send(data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error:', error);
|
console.error(error);
|
||||||
res.status(500).send('Internal Server Error');
|
res.status(500).send('Internal Server Error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -12,8 +12,9 @@ async function getallData() {
|
|||||||
return allData;
|
return allData;
|
||||||
}
|
}
|
||||||
catch(error) {
|
catch(error) {
|
||||||
console.error('Error:', error);
|
console.error(error);
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,8 +28,9 @@ router.get('/', async (req, res) => {
|
|||||||
res.send(data);
|
res.send(data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error:', error);
|
console.error(error);
|
||||||
res.status(500).send('Internal Server Error');
|
res.status(500).send('Internal Server Error');
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user