2022-12-19 18:07:36 +00:00
|
|
|
/* Pellet Stove Control Panel
|
|
|
|
* Web Configuration Server
|
|
|
|
* v0.0.0 by Skylar Grant
|
2022-12-20 02:55:50 +00:00
|
|
|
*
|
|
|
|
* TODOs:
|
|
|
|
* Implement Express to make it easier
|
|
|
|
* Add actual data into the responses
|
|
|
|
* Launching point: https://stackoverflow.com/questions/18831783/how-to-call-a-server-side-function-from-client-side-e-g-html-button-onclick-i
|
2022-12-19 18:07:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
const http = require('http');
|
|
|
|
const host = 'localhost';
|
|
|
|
const port = 8080;
|
|
|
|
const config = require('./config.json');
|
|
|
|
|
|
|
|
const requestListener = (req, res) => {
|
|
|
|
res.writeHead(200);
|
|
|
|
res.end('PSControlPanel Web Server')
|
|
|
|
};
|
|
|
|
|
|
|
|
const server = http.createServer(requestListener);
|
|
|
|
|
|
|
|
server.listen(port, host, () => {
|
|
|
|
if (config.debugMode) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: Started web config portal.`);
|
|
|
|
})
|