|
|
@ -8,38 +8,53 @@ |
|
|
|
const http = require('http'); |
|
|
|
|
|
|
|
const url = require('url'); |
|
|
|
|
|
|
|
const includes = require('./includes/includes.js'); |
|
|
|
|
|
|
|
http.createServer(function (request_url, res) |
|
|
|
{ |
|
|
|
var q = url.parse(request_url.url, true); |
|
|
|
var filename = q.pathname; |
|
|
|
|
|
|
|
console.log(filename.split("/")); |
|
|
|
console.log(filename); |
|
|
|
//prints header
|
|
|
|
includes.printHeader(res); |
|
|
|
|
|
|
|
if(filename.includes("/category")) |
|
|
|
{ |
|
|
|
//categories or view a category page
|
|
|
|
|
|
|
|
} |
|
|
|
else if(filename.includes("/downloads/")) |
|
|
|
|
|
|
|
|
|
|
|
//handles image requests
|
|
|
|
if(filename.includes("/img/")) |
|
|
|
{ |
|
|
|
//downloads page
|
|
|
|
//probably will be implemented later
|
|
|
|
require("./img/image.js").main(res, filename); |
|
|
|
} |
|
|
|
else if(filename.includes("/admin")) |
|
|
|
else |
|
|
|
{ |
|
|
|
includes.printHeader(res); |
|
|
|
|
|
|
|
//categories or view a category page
|
|
|
|
if(filename.includes("/category")) |
|
|
|
require("../posts/category.js").main(res, filename); |
|
|
|
//downloads page
|
|
|
|
else if(filename.includes("/downloads/")) |
|
|
|
{} |
|
|
|
|
|
|
|
|
|
|
|
//admin page
|
|
|
|
else if(filename.includes("/admin")) |
|
|
|
require("./admin/admin.js").main(res, filename); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//normal blog entry
|
|
|
|
require("./posts/posts.js").main(res, filename); |
|
|
|
else |
|
|
|
require("./posts/posts.js").main(res, filename); |
|
|
|
|
|
|
|
|
|
|
|
//includes footer file
|
|
|
|
includes.printFooter(res); |
|
|
|
} |
|
|
|
|
|
|
|
//includes footer file
|
|
|
|
includes.printFooter(res); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).listen(8080); |