How to use the serveStatic function from restify
Find comprehensive JavaScript restify.serveStatic code examples handpicked from public code repositorys.
133 134 135 136 137 138 139 140 141
// Message server.post('/api/message/', post_message); // Static Content ///////////////////////////////////////////// server.get(/\/(css|img|js)?.*/, restify.serveStatic({ directory: './static', default: 'index.html' }));
+ 3 other calls in file
GitHub: ryanj/restify-postGIS
![ryanj profile picture](/ryanj.png?size=40)
23 24 25 26 27 28 29 30 31 32
res.status(200); res.header('Content-Type', 'text/html'); res.end(data.toString().replace(/host:port/g, req.header('Host'))); }); app.get(/\/(css|js|img)\/?.*/, restify.serveStatic({directory: __dirname+'/static'})); app.listen(config.get('PORT'), config.get('IP'), function () { console.log( "Listening on " + config.get('IP') + ", port " + config.get('PORT') ) });
43 44 45 46 47 48 49 50 51 52
name: { isRequired: true, scope: 'body' }, email: { isRequired: true, isEmail: true, scope: 'body' }, website: { isRequired: true, isUrl: true, scope: 'body' } } }, api.register); server.get(/\/developers\/api-explorer\/?.*/, restify.serveStatic({ directory: __dirname + '/..', default: 'index.html' })); server.get(/\/examples\/browser\/?.*/, restify.serveStatic({
+ 7 other calls in file
GitHub: Manolete919/DO180-all
14 15 16 17 18 19 20 21 22 23 24 25
.use(restify.bodyParser()) .use(restify.CORS()); controller.context(server, '/todo/api', model); server.get(/\/todo\/?.*/, restify.serveStatic({ 'directory': __dirname, 'default': 'index.html' }));
+ 2 other calls in file
259 260 261 262 263 264 265 266 267 268
serve_get_category); pkg_server.get(pkg_prefix + '/api/set/:set/category/:category', serve_get_catinfo); /* HTML */ staticfunc = mod_restify.serveStatic({ directory: mod_path.join(__dirname, 'html') }); pkg_server.get(new RegExp('^' + pkg_prefix + '/set.*/'),
+ 2 other calls in file
GitHub: maguon/log_api
187 188 189 190 191 192 193 194 195 196 197 198 199 200
// static files: /, /index.html, /images... //var STATIS_FILE_RE = /\/?\.css|\/?\.js|\/?\.png|\/?\.jpg|\/?\.gif|\/?\.jpeg|\/?\.less|\/?\.eot|\/?\.svg|\/?\.ttf|\/?\.otf|\/?\.woff|\/?\.pdf|\/?\.ico|\/?\.json|\/?\.wav|\/?\.mp3/; var STATIS_FILE_RE = /\.(css|js|jpe?g|png|gif|less|eot|svg|bmp|tiff|ttf|otf|woff|pdf|ico|json|wav|ogg|mp3?|xml|woff2|map)$/i; server.get(STATIS_FILE_RE, restify.plugins.serveStatic({ directory: './public/docs', default: 'index.html', maxAge: 0 })); // server.get(/^\/((.*)(\.)(.+))*$/, restify.serveStatic({ directory: './TruMenuWeb', default: "index.html" })); server.get(/\.html$/i,restify.plugins.serveStatic({
83 84 85 86 87 88 89 90
/** * Server static content. a light wrapper. * @param options */ serverStatic: function(options) { return restify.serveStatic(options); } };
+ 9 other calls in file
GitHub: mulderp/movies-obscura
![mulderp profile picture](/mulderp.png?size=40)
26 27 28 29 30 31 32 33 34 35
//console.log(genres); res.send(genres_ids); }) //serve static content server.get(/\/.*/, restify.serveStatic({ directory: './public', default: 'index.html' }));
restify.createServer is the most popular function in restify (1059 examples)