idk anymore
This commit is contained in:
parent
84c8ff3708
commit
89504f0f2d
3522
package-lock.json
generated
3522
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,9 @@
|
|||||||
"packages": {},
|
"packages": {},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"rpi-gpio": "^2.1.7"
|
"express": "^4.18.2",
|
||||||
|
"rpi-gpio": "^2.1.7",
|
||||||
|
"sequelize": "^6.28.0",
|
||||||
|
"sqlite3": "^5.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
websvr.js
20
websvr.js
@ -8,18 +8,16 @@
|
|||||||
* Launching point: https://stackoverflow.com/questions/18831783/how-to-call-a-server-side-function-from-client-side-e-g-html-button-onclick-i
|
* Launching point: https://stackoverflow.com/questions/18831783/how-to-call-a-server-side-function-from-client-side-e-g-html-button-onclick-i
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const express = require('express');
|
||||||
|
const app = express();
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const host = 'localhost';
|
const server = http.createServer(app);
|
||||||
const port = 8080;
|
|
||||||
const config = require('./config.json');
|
const config = require('./config.json');
|
||||||
|
|
||||||
const requestListener = (req, res) => {
|
app.use(express.bodyParser());
|
||||||
res.writeHead(200);
|
app.post('/', (req, res) => {
|
||||||
res.end('PSControlPanel Web Server')
|
if (config.debugMode) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: ${req.body}`);
|
||||||
};
|
res.send(200);
|
||||||
|
});
|
||||||
|
|
||||||
const server = http.createServer(requestListener);
|
server.listen(config.web.port, config.web.ip);
|
||||||
|
|
||||||
server.listen(port, host, () => {
|
|
||||||
if (config.debugMode) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: Started web config portal.`);
|
|
||||||
})
|
|
Loading…
Reference in New Issue
Block a user