Handle push state entirely
This commit is contained in:
@@ -41,4 +41,6 @@ DocumentHandler.prototype.handlePost = function(request, response) {
|
||||
});
|
||||
};
|
||||
|
||||
// TODO block modifying
|
||||
|
||||
module.exports = DocumentHandler;
|
||||
|
@@ -25,6 +25,7 @@ StaticHandler.contentTypeFor = function(ext) {
|
||||
// Handle a request, and serve back the asset if it exists
|
||||
StaticHandler.prototype.handle = function(incPath, response) {
|
||||
var filePath = this.basePath + (incPath == '/' ? this.defaultPath : incPath);
|
||||
var _this = this;
|
||||
path.exists(filePath, function(exists) {
|
||||
if (exists) {
|
||||
fs.readFile(filePath, function(error, content) {
|
||||
@@ -41,9 +42,11 @@ StaticHandler.prototype.handle = function(incPath, response) {
|
||||
});
|
||||
}
|
||||
else {
|
||||
winston.warn('file not found', { path: filePath });
|
||||
response.writeHead(404, { 'content-type': 'application/json' });
|
||||
response.end(JSON.stringify({ message: 'file not found' }));
|
||||
// TODO 404 if not match regex
|
||||
//winston.warn('file not found', { path: filePath });
|
||||
//response.writeHead(404, { 'content-type': 'application/json' });
|
||||
//response.end(JSON.stringify({ message: 'file not found' }));
|
||||
_this.handle('/', response);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user