Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
godot: config.get('godot'),
plugins: [ probe, layout, watch, godot ],
transformer: 'sockjs'
});
//
// Add some producers to the godot client if it exists
//
if (pipe.godot) pipe.godot.add(new Memory({ service: service }));
//
// Add middleware.
//
pipe
.before(connect.static(path.join(__dirname, 'public')))
.before(connect.favicon(path.join(__dirname, 'public', 'favicon.png')));
//
// Listen for errors and the listen event.
//
pipe.on('error', function error(err) {
console.error('Browsenpm.org received an error:'+ err.message, err.stack);
});
pipe.once('listening', function listening() {
console.log('Browsenpm.org is now running on http://localhost:%d', port);
});
//
// Start listening when all data is properly prepared and fetched.
//
pipe.once('initialized', pipe.listen.bind(pipe, port));
static: true
};
const app = connect()
.use(function(req, res, next) {
// convert all the md files on every request. This is not optimal
// but fast enough that we don't really need to care right now.
if (!server.noconvert && req.url.match(/\.html|\/$/)) {
var extractDocs = req.url.match(/\/docs/); // Lazily extract docs.
convert({extractDocs});
}
next();
})
.use(reactMiddleware.provide(buildOptions))
.use(connect.static(FILE_SERVE_ROOT))
.use(connect.favicon(path.join(FILE_SERVE_ROOT, 'react-native', 'img', 'favicon.png')))
.use(connect.logger())
.use(connect.compress())
.use(connect.errorHandler());
const portToUse = port || 8079;
const server = http.createServer(app);
server.listen(portToUse, function(){
console.log('Open http://localhost:' + portToUse + '/react-native/index.html');
});
module.exports = server;
module.exports = function(setting){
var utl = require('./util.js')
, cfg = require('./cfg.js')
;
utl.override2(cfg, setting);
cfg.upload_dir && utl.ensureDir(cfg.upload_dir);
var common = require('./common.js')
, c = require('connect')
, app = c.createServer()
;
// 1. for favicon
app.use(c.favicon(cfg.favicon_path, {maxAge : cfg.favicon_max_age}));
common.mount_doc(app);
app.use(cfg.file_mount_point, common.mount_static(c.createServer()));
app.use(cfg.plsql_mount_point || '/', require('./psp.web.js'));
console.info('This is combined/integrated server (service both dynamic PL/SQL page and static file) ');
console.info('Usage: Noradle.runCombined({ oracle_port:1521, http_port:80, https_port:443 ... });');
common.start_dynamic(app);
};
server = function server(config) {
// but only for configuration with config.server set to true (--server)
if(!config.server) return;
connect.createServer()
.use(connect.logger({format: '> :date :method :url'}))
.use(connect.favicon(Path.join(__dirname, '../public/favicon.ico')))
.use(config.baseurl || '', connect.static(Path.join(config.dest)))
.listen(config.port);
console.log('\nServer started: localhost:', config.port);
},
var msgs = this.session.flash = this.session.flash || {};
if (type && msg) {
(msgs[type] = msgs[type] || []).push(msg);
} else if (type) {
var arr = msgs[type];
delete msgs[type];
return arr || [];
} else {
this.session.flash = {};
return msgs;
}
};
connect.createServer(
connect.favicon(),
connect.bodyParser(),
connect.cookieParser(),
// reap every 6 seconds, 6 seconds maxAge
connect.session({cookie: {maxAge: 6000}, store: mongo_store, secret: 'foo'}),
// Increment views
function (req, res) {
req.session.count = req.session.count || 0
++req.session.count;
// Display online count
req.sessionStore.length(function(err, len){
if (req.session.count < 10) {
var msgs = req.flash('info').join('\n');
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write(msgs);
var connect = require('connect'),
http = require('http');
var static = connect.static('public');
static.label = 'static';
var app = connect();
var connectr = require('./')(app);
var cookieParser = connect.cookieParser();
cookieParser.label = 'cookieParser';
app.use(connect.favicon())
.use(static);
connectr.use(connect.bodyParser).as('bodyParser')
.use(connect.directory('public')).as('directory')
.use(cookieParser)
.use(connect.session({ secret: 'my secret here' }));
app.use(function(req, res){
res.end('Hello from Connect!\n');
});
//connectr.use(connect.bodyParser).as('bodyParser');
// use `as` only if connect.bodyParser doesn't have a label property
//connect.use(connect.bodyParser);
var tests = eval('[' + js + ']');
tests.forEach(function(test) {
test.genre = test.name.split('-')[0];
});
res.statusCode = 200;
mu.render('multi.html.mu', { tests: tests, js: js }).pipe(res);
});
};
if (process.env.PORT) {
connect.createServer(
connect.router(router),
connect.staticCache(),
connect.static(__dirname + '/public'),
connect.favicon(__dirname + '/public/images/favicon.ico')
).listen(process.env.PORT);
} else {
connect.createServer(
connect.logger('dev'),
connect.router(router),
connect.static(__dirname + '/public')
).listen(3000)
}
},
blacklistRE: argv.blacklistRE && new RegExp(argv.blacklistRE),
serverRender: 'serverRender' in argv ?
argv.serverRender === 'true': defaults.serverRender,
dev: argv.dev === 'true'
};
if (!isServer) {
reactMiddleware.compute(buildOptions)(argv.computeForPath, function(str) {
process.stdout.write(str);
});
} else {
var app = connect()
.use(reactMiddleware.provide(buildOptions))
.use(connect['static'](FILE_SERVE_ROOT))
.use(connect.favicon(path.join(FILE_SERVE_ROOT, 'elements', 'favicon', 'favicon.ico')))
.use(connect.logger())
.use(connect.compress())
.use(connect.errorHandler());
var portToUse = port || 8080;
http.createServer(app).listen(portToUse);
console.log('Open http://localhost:' + portToUse + '/index.html');
}
next();
}
});
}
}
var connect = require('connect'),
http = require('http'),
fs = require('fs'),
custom = require('./custom'),
base = '/home/examples/public_html';
http.createServer(connect()
.use(connect.favicon(base + '/favicon.ico'))
.use(connect.logger())
.use(custom(base + '/public_html', '404 File Not Found',
'403 Directory Access Forbidden'))
.use(connect.static(base))
).listen(8124);