MCPcopy Create free account
hub / github.com/socketstream/socketstream / route

Function route

lib/http/cached.js:78–91  ·  view source on GitHub ↗
(url, fn, filePath)

Source from the content-addressed store, hash-verified

76
77
78 function route(url, fn, filePath) {
79 if (url.charAt(0) !== '/') { url = '/'+url; }
80 // console.log('route defined',url);
81 var point = getPoint(url);
82 if (point) {
83 if (fn) { point.handle = fn; }
84 if (filePath) { point.filePath = filePath; }
85 } else {
86 point = new KnownPoint(url, fn, filePath);
87 if (!fn) {
88 debug('added known point %s pointing to static file %s',url,filePath);
89 }
90 }
91 }
92
93 return {
94 get middleware() {

Callers 1

cached.jsFile · 0.85

Calls 1

getPointFunction · 0.85

Tested by

no test coverage detected