How to use the express.favicon function in express

To help you get started, we’ve selected a few express examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paragi / was / server.js View on Github external
app.all(/^\/$/, function(request, response, next) {
    request.url=config.defaultRootDocument;
    if(logMode>=mumble) console.log(" Using root document default: " + config.defaultRootDocument);
    next('route');
  });
}

// Add Dynamic script support
nscript.docRoot = config.docRoot;
nscript.defaultRootDocument = config.defaultRootDocument;
nscript.cgiEngine = config.cgiEngine;
app.all(/./,nscript.expressLaunch);

// Apply static page server for the rest
app.use(express.static(config.docRoot));
app.use(express.favicon(config.docRoot + '/favicon.ico')); 
console.log("Serving static files at: " + config.docRoot);

/*============================================================================*\
  Start listening
\*============================================================================*/
// Listen on PORT and call function on incomming requests
server.listen(config.port,config.ip);
console.log("Server listening at: " + config.ip + ":" + config.port );

/*============================================================================*\
  Error handler 
\*============================================================================*/
// Catch errors
if(config.debugMode.toLowerCase().charAt(0)!='y'){
  process.on('uncaughtException', function (err) {
      console.error('An uncaughtException:');
github hawtio / hawtio-ui / libs / patternfly-bootstrap-treeview / app.js View on Github external
/**
 * Module dependencies.
 */

var express = require('express');
var http = require('http');
var path = require('path');

var app = express();

// all environments
app.set('port', process.env.PORT || 3000);
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(express.static(path.join(__dirname, '/public')));
app.use(express.static(path.join(__dirname, '/tests')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});
github azat-co / practicalnode / ch9 / socket / app.js View on Github external
* Module dependencies.
 */

var express = require('express');
var routes = require('./routes');
var user = require('./routes/user');
var http = require('http');
var path = require('path');

var app = express();

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

app.get('/', routes.index);
app.get('/users', user.list);

var server = http.createServer(app);
var io = require('socket.io').listen(server);
github godratio / Blogular / app.js View on Github external
app.configure(function () {
    //noinspection JSUnresolvedVariable,JSValidateTypes,MagicNumberJS
    app.set('port', process.env.PORT || 3000);
    //noinspection JSUnresolvedVariable
    app.set('views', __dirname + '/views');
    app.set('view engine', 'jade');
    //noinspection JSUnresolvedFunction
    app.use(express.favicon());
    app.use(express.logger('dev'));
    //noinspection JSUnresolvedFunction
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(express.cookieParser('secret'));
    //TODO:Config: make secrete changable in config
    app.use(express.session({store: sessionStore, secret: 'secret', key: 'express.sid'}));
    // Initialize Passport! Also use passport.session() middleware, to support
    // persistent login sessions (recommended).
    app.use(passport.initialize());
    app.use(passport.session());
    app.use(app.router);
    app.use(require('less-middleware')({ src: __dirname + '/public' }));
    app.use(express.static(path.join(__dirname, 'public')));
});
github davidlygagnon / node-js-in-action / shoutbox / app.js View on Github external
, http = require('http')
  , path = require('path')
  , entries = require('./routes/entries')
  , validate = require('./lib/middleware/validate')
  , page = require('./lib/middleware/page')
  , Entry = require('./lib/entry')
  , api = require('./routes/api')
  , Entry = require('./lib/entry');

var app = express();

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/api', api.auth);
app.use(user);
app.use(messages);
app.use(app.router);

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}
github daviddahl / nulltxt / deprecated / server / app.js View on Github external
app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(path.join(__dirname, 'public')));
});
github TossShinHwa / CMS / server / server.js View on Github external
//dependencies
var express = require("express"),
  http = require("http"),
  path = require("path"),
  app = express(),
  config = require("./config/config"),
  mongoose = require('mongoose');

//db init
mongoose.connect(config.db);

//express init
//app.use(express.logger('dev')); /*'default', 'short', 'tiny', 'dev'*/
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.favicon(path.join(__dirname, '../client/img/favicon.ico')));
app.use(express["static"](path.join(__dirname, "../client")));

//application init
require('./bootstrap/registerModels')();
require('./bootstrap/registerRewrite')(app);
require('./bootstrap/registerAPIs')(app);

//data init
require('./bootstrap/db/init')();

app.listen(process.env.PORT || config.port || 30000);
github prototypsthlm / Switchboard / the_operator / app.js View on Github external
app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(require('stylus').middleware(__dirname + '/public'));
  app.use(express.static(__dirname + '/public'));
});
github rajaraodv / rabbitpubsub / app.js View on Github external
app.configure(function () {
    app.set('port', process.env.PORT || 3000);
    app.set('views', __dirname + '/views');
    app.set('view engine', 'ejs');
    app.use(express.favicon());
    app.use(express.logger('dev'));
    app.use(express.bodyParser());
    app.use(express.methodOverride());

    /*
     Use cookieParser and session middlewares together.
     By default Express/Connect app creates a cookie by name 'connect.sid'.But to scale Socket.io app,
     make sure to use cookie name 'jsessionid' (instead of connect.sid) use Cloud Foundry's 'Sticky Session' feature.
     W/o this, Socket.io won't work if you have more than 1 instance.
     If you are NOT running on Cloud Foundry, having cookie name 'jsessionid' doesn't hurt - it's just a cookie name.
     */
    app.use(cookieParser);
    app.use(express.session({store: sessionStore, key: 'jsessionid', secret: 'your secret here'}));

    app.use(app.router);
    app.use(express.static(path.join(__dirname, 'public')));
github jidesoft / jidejs / Gruntfile.js View on Github external
grunt.registerTask('run', [], function() {
		var done = this.async();
		var express = require('express')
			, http = require('http')
			, path = require('path')
			, lessMiddleware = require('less-middleware');

		var app = express();
		app.use(express.favicon());
		app.use(express.logger('dev'));
		app.use(express.compress());
		app.use('/demo', lessMiddleware({
			src: __dirname + '/demo',
			compress: false
		}));
		app.use('/jidejs', lessMiddleware({
			src: __dirname + '/style',
			compress: false
		}));
        app.use('/jidejs/base', express.static(__dirname+'/base'));
		app.use('/jidejs/ui', express.static(__dirname+'/ui'));
		app.use('/jidejs', express.static(__dirname+'/style'));
		app.use('/demo', express.static(__dirname+'/demo'));
        app.use('/bower_components', express.static(__dirname+'/bower_components'));
		app.listen(3000).on('close', done);