Add extras handler

This commit is contained in:
tgpethan 2019-11-23 20:33:53 +00:00
parent 3b891869b8
commit 70c48b1cce
3 changed files with 12 additions and 5 deletions

View file

@ -1,4 +1,6 @@
# Revolution <h1 align="center">
Revolution is a web server that I designed to be flexible to fit the needs of it's applications. <img height="150" src="http://ethanus.ml/images/Revolution.png">
It is mainly used in my Screenshot server, EUS which was recently rewriten. </h1>
It's main design goal was to be modular. <p align="center">Revolution is a web server that I designed to be flexible to fit the needs of it's applications.</p>
<p align="center">It is mainly used in my Screenshot server, EUS which was recently rewriten.</p>
<p align="center">It's main design goal was to be modular.</p>

View file

@ -1,5 +1,4 @@
const express = require("express"), const express = require("express"),
app = express(),
fs = require("fs"), fs = require("fs"),
chalk = require("chalk"), chalk = require("chalk"),
config = require("./config/config.json"), config = require("./config/config.json"),
@ -8,6 +7,7 @@ global.actualDir = __dirname;
global.internals = { global.internals = {
version:"Open Source", version:"Open Source",
}; };
global.app = express();
global.modules = []; global.modules = [];
let dE = new Date(), let dE = new Date(),
startTime = dE.getTime(), startTime = dE.getTime(),
@ -53,6 +53,7 @@ fs.readFile('./misc/ascii.txt', function(err, data) {
}); });
function server() { function server() {
reqhandler.extras();
app.get('*', (req, res) => reqhandler.get(req, res)); app.get('*', (req, res) => reqhandler.get(req, res));
app.post('*', (req, res) => reqhandler.post(req, res)); app.post('*', (req, res) => reqhandler.post(req, res));
app.listen(config.server.port, () => { app.listen(config.server.port, () => {

View file

@ -17,6 +17,10 @@ if (!fs.existsSync(__dirname + BASE_PATH + "/files")) {
} }
module.exports = { module.exports = {
extras:function() {
// Anything else that is needed like busboy
// Put them to global.app (the express app)
},
get:function(req, res) { get:function(req, res) {
/* /*
req - Request from client req - Request from client