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