From 70c48b1ccec6bd849ed5e884fa0a95bec2511965 Mon Sep 17 00:00:00 2001 From: tgpethan Date: Sat, 23 Nov 2019 20:33:53 +0000 Subject: [PATCH] Add extras handler --- README.md | 10 ++++++---- index.js | 3 ++- modules/example_request_handler.js | 4 ++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 077b946..c823dc0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# Revolution -Revolution is a web server that I designed to be flexible to fit the needs of it's applications. -It is mainly used in my Screenshot server, EUS which was recently rewriten. -It's main design goal was to be modular. +

+ +

+

Revolution is a web server that I designed to be flexible to fit the needs of it's applications.

+

It is mainly used in my Screenshot server, EUS which was recently rewriten.

+

It's main design goal was to be modular.

diff --git a/index.js b/index.js index 39e0f91..5fe520f 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,4 @@ const express = require("express"), -app = express(), fs = require("fs"), chalk = require("chalk"), config = require("./config/config.json"), @@ -8,6 +7,7 @@ global.actualDir = __dirname; global.internals = { version:"Open Source", }; +global.app = express(); global.modules = []; let dE = new Date(), startTime = dE.getTime(), @@ -53,6 +53,7 @@ fs.readFile('./misc/ascii.txt', function(err, data) { }); function server() { + reqhandler.extras(); app.get('*', (req, res) => reqhandler.get(req, res)); app.post('*', (req, res) => reqhandler.post(req, res)); app.listen(config.server.port, () => { diff --git a/modules/example_request_handler.js b/modules/example_request_handler.js index 73ef0ee..c9e7129 100644 --- a/modules/example_request_handler.js +++ b/modules/example_request_handler.js @@ -17,6 +17,10 @@ if (!fs.existsSync(__dirname + BASE_PATH + "/files")) { } module.exports = { + extras:function() { + // Anything else that is needed like busboy + // Put them to global.app (the express app) + }, get:function(req, res) { /* req - Request from client