MCPcopy Create free account
hub / github.com/restify/node-restify / serveNormal

Function serveNormal

lib/plugins/static.js:145–165  ·  view source on GitHub ↗
(file, req, res, next)

Source from the content-addressed store, hash-verified

143 }
144
145 function serveNormal(file, req, res, next) {
146 fs.stat(file, function fileStat(err, stats) {
147 if (!err && stats.isDirectory() && opts.default) {
148 // Serve an index.html page or similar
149 var filePath = path.join(file, opts.default);
150 fs.stat(filePath, function dirStat(dirErr, dirStats) {
151 serveFileFromStats(
152 filePath,
153 dirErr,
154 dirStats,
155 false,
156 req,
157 res,
158 next
159 );
160 });
161 } else {
162 serveFileFromStats(file, err, stats, false, req, res, next);
163 }
164 });
165 }
166
167 function serve(req, res, next) {
168 var file;

Callers 1

serveFunction · 0.85

Calls 1

serveFileFromStatsFunction · 0.85

Tested by

no test coverage detected