Add comments to the framework & included modules #16
1 changed files with 3 additions and 0 deletions
|
@ -29,11 +29,14 @@ module.exports = {
|
||||||
res - Response from server
|
res - Response from server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Make sure the file exists
|
||||||
fs.access(__dirname + BASE_PATH + "/files" + req.url, fs.F_OK, error => {
|
fs.access(__dirname + BASE_PATH + "/files" + req.url, fs.F_OK, error => {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
// File doesn't exist, return a 404 to the client.
|
||||||
global.modules.consoleHelper.printWarn(emoji.page, `${req.method}: ${req.url} was requested - Returned 404`);
|
global.modules.consoleHelper.printWarn(emoji.page, `${req.method}: ${req.url} was requested - Returned 404`);
|
||||||
res.status(404).send("404!<hr>Revolution");
|
res.status(404).send("404!<hr>Revolution");
|
||||||
} else {
|
} else {
|
||||||
|
// File does exist, send the file back to the client.
|
||||||
global.modules.consoleHelper.printInfo(emoji.page, `${req.method}: ${req.url} was requested`);
|
global.modules.consoleHelper.printInfo(emoji.page, `${req.method}: ${req.url} was requested`);
|
||||||
res.sendFile(__dirname + BASE_PATH + "/files" + req.url);
|
res.sendFile(__dirname + BASE_PATH + "/files" + req.url);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue