idk anymore

This commit is contained in:
Skylar Grant 2022-12-20 14:18:24 -05:00
parent 84c8ff3708
commit 89504f0f2d
4 changed files with 3534 additions and 13 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

3522
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -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"
} }
} }

View File

@ -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.`);
})