Created
November 3, 2012 04:45
-
-
Save techwraith/4006019 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Send a static file path | |
sendStaticFile = function (p) { | |
staticResp = new response.Response(resp); | |
// May be a path to a directory, with or without a trailing | |
// slash -- any trailing slash has already been stripped by | |
// this point | |
if (fs.statSync(p).isDirectory()) { | |
// TODO: Make the name of any index file configurable | |
<<<<<<< HEAD | |
p = path.join(p, 'index.html'); | |
if (utils.file.existsSync(p) && fs.statSync(p).isFile()) { | |
staticResp.sendFile(p); | |
} | |
} | |
// Path to an actual file. Just serve it up | |
else if (fs.statSync(p).isFile()) { | |
staticResp.sendFile(p); | |
======= | |
staticPath = path.join(staticPath, 'index.html'); | |
if (utils.file.existsSync(staticPath) && fs.statSync(staticPath).isFile()) { | |
controller = new StaticFileController(staticPath, reqObj, respObj); | |
controller.respond(); | |
} | |
} | |
// Path to an actual file. Just serve it up | |
else if (fs.statSync(staticPath).isFile()) { | |
controller = new StaticFileController(staticPath, reqObj, respObj); | |
controller.respond(); | |
>>>>>>> master | |
} | |
}; | |
// If the path is in the static file path send it | |
if (utils.file.existsSync(publicPath)) { | |
sendStaticFile(publicPath); | |
} | |
// If the path includes the full partials path and is in the partials file in views send it | |
else if (staticUrl.match('partials/') && utils.file.existsSync(partialsPath)) { | |
sendStaticFile(partialsPath); | |
} | |
// Must be a 404 or 405 | |
// 405? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment