Convert to tabs.

This commit is contained in:
Hyperling 2022-10-06 22:15:36 -05:00
parent 28c393c339
commit ac20b32b57

70
main.js
View File

@ -29,52 +29,52 @@ ports.push(8080);
async function main() { async function main() {
console.log("Starting Main"); console.log("Starting Main");
app.use(function (req, res, next) { app.use(function (req, res, next) {
res.contentType('text/html'); res.contentType('text/html');
next(); next();
}); });
console.log("Adding Routes"); console.log("Adding Routes");
let router = express.Router(); let router = express.Router();
/* MANUAL METHOD, SPECIFY EVERY PATH+FILE /* MANUAL METHOD, SPECIFY EVERY PATH+FILE
router.get('/', function (req, res) { router.get('/', function (req, res) {
console.log("Fetching"); console.log("Fetching");
require('lib/home.js'); // one way, maybe? require('lib/home.js'); // one way, maybe?
}); });
router.get('/notice', function (req, res) { router.get('/notice', function (req, res) {
pages.notice(req, res); // another way? pages.notice(req, res); // another way?
}); });
*/ */
/* AUTOMATIC METHOD BASED ON OBJECT/ARRAY /* AUTOMATIC METHOD BASED ON OBJECT/ARRAY
for page in pages { // FORTESTING pseudocode for page in pages { // FORTESTING pseudocode
router.get("/" + page.key, function (req,res) { router.get("/" + page.key, function (req,res) {
page.value(req, res); page.value(req, res);
}); });
} }
*/ */
/* AUTOMATIC METHOD BASED ON OBJECT/ARRAY OF PHP scripts /* AUTOMATIC METHOD BASED ON OBJECT/ARRAY OF PHP scripts
for page in pages { // FORTESTING pseudocode for page in pages { // FORTESTING pseudocode
router.get("/" + page.key, function (req,res) { router.get("/" + page.key, function (req,res) {
res.send(system("php page.value")); res.send(system("php page.value"));
}); });
} }
*/ */
// Test (Also a decent catch-all to Home!) // Test (Also a decent catch-all to Home!)
router.get('/*', function (req, res) { router.get('/*', function (req, res) {
//console.log(req); //console.log(req);
//console.log(res); //console.log(res);
console.log(req.socket.remoteAddress, "asked for", req.url) console.log(req.socket.remoteAddress, "asked for", req.url)
let html = execSync("php ./pages/home.php"); let html = execSync("php ./pages/home.php");
res.send(html); res.send(html);
}); });
app.use('', router); app.use('', router);
console.log("Adding Ports"); console.log("Adding Ports");
ports.forEach(port => { ports.forEach(port => {
app.listen(port); app.listen(port);
console.log(" * Now listening on port " + port + "."); console.log(" * Now listening on port " + port + ".");
}); });
console.log("Done! Now we wait..."); console.log("Done! Now we wait...");
} }