Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

30 lines
686 B

const routes = require('express').Router();
const url = require('url');
const contentLoader = require('../../includes/staticContentServer.js');
routes.get('*', (request, result) =>
{
var filename = url.parse(request.url, true).pathname;
var extra = '';
if(filename === '/')
{
if(request.originalUrl.charAt(request.originalUrl.length -1) !== '/')
{
result.redirect(request.originalUrl + "/");
}
else
{
extra = "/index.html";
}
}
if(!contentLoader.serveStaticContent(request, result,
request.originalUrl + extra, "blogContent/projects"))
{
}
});
module.exports = routes;