Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.catch((err) => {
console.log('Passport error:', err);
done(err);
});
}
));
app.use(cors());
app.use(router.routes());
app.use(static(path.join(__dirname, '../front/static')));
app.use(favicon(path.join(__dirname, '../front/static/favicon.ico')));
const port = process.env.PORT || config.port;
// models.sequelize.sync({ force: true })
models.sequelize.sync()
.then(() => {
app.listen(port);
app.on('error', (error) => {
console.error('App error:', error);
process.exit(1);
});
console.log(`Server running on port ${port}`);
});
import logger from './lib/logger';
const app = express();
expressLib(app);
/**
* Routes.
*/
routes(app);
/**
* Start server
*/
const server = app.listen(config.port, () => {
const host = os.hostname();
logger.info(
'Open Collective API listening at http://%s:%s in %s environment.\n',
host,
server.address().port,
config.env,
);
if (config.maildev.server) {
const maildev = require('./maildev'); // eslint-disable-line @typescript-eslint/no-var-requires
maildev.listen();
}
});
server.timeout = 25000; // sets timeout to 25 seconds
/**
origin: '*'
}))
const UsersRouter = require('./users.js')
app.use('/', UsersRouter)
// Exception handling. The Sentry error handler must be before any other error middleware.
if (Config.sentryUrl) {
app.use(raven.middleware.express.errorHandler(Config.sentryUrl))
app.use(ravenOnError)
}
app.listen(Config.port)
Util.logger.info(`NODE_ENV: ${Config.util.getEnv('NODE_ENV')}`)
Util.logger.info(`sync server up on localhost:${Config.port}`)
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
const { logger } = global;
const config = require('config');
const Koa = require('koa');
process.on('unhandledRejection', (reason, p) => {
logger.log('Possibly Unhandled Rejection at: Promise ', p, ' reason: ', reason);
// application specific logging here
});
const app = new Koa();
require('./config/koa')(app);
app.listen(config.port, () => {
logger.warn(`Api server listening on ${config.port}, in ${process.env.NODE_ENV} mode`);
});
module.exports = app;
var Hapi = require('hapi');
var path = require('path');
var settings = require('config');
var routes = require('./routes');
var plugins = require('./plugins');
var models = require('./models');
const internals = {
templatePath: '.'
};
const server = new Hapi.Server({
host:settings.host,
port: settings.port
});
// server.connection({port:settings.port, host:settings.host});
// Export the server to be required elsewhere.
var initDb = function(cb){
var sequelize = models.sequelize;
//Test if we're in a sqlite memory database. we may need to run migrations.
if(sequelize.getDialect()==='sqlite' &&
(!sequelize.options.storage || sequelize.options.storage === ':memory:')){
sequelize.getMigrator({
path: process.cwd() + '/migrations',
}).migrate().success(function(){
// The migrations have been executed!
//static files
app.use(favicon(path.join(__dirname, '../static/favicon.ico')));
app.use('/', express.static(path.join(__dirname, '../static')));
//bundles are mapped like this so dev and prod builds both work (as dev uses src/static while prod uses dist/static)
app.use('/bundles', express.static(path.join(__dirname, '../../dist/bundles')));
//API
app.get('/api/users', getUsers);
//all page rendering
//Note: handles page routing and 404/500 error pages where necessary
app.get('*', renderPageRoute);
const server = app.listen(config.port, function () {
banner();
log.info(`Server started on port ${server.address().port} in ${app.get('env')} mode`);
//Its very useful to output init config to console at startup but we deliberately dont dump it to
//log files incase it contains sensetive info (like keys for services etc)
console.log(config);//eslint-disable-line no-console
//'ready' is a hook used by the e2e (integration) tests (see node-while)
server.emit('ready');
});
//export server instance so we can hook into it in e2e tests etc
export default server;
'use strict'
require('../models')
const config = require('config')
const app = require('../app')
app.listen(config.port, () => {
console.log(`Server listening on port => ${config.port} at ${new Date()}`)
})
.then(() => {
app.listen(config.port, () => {
console.info(`Listening to http://localhost:${config.port}`);
});
})
.catch((err) => {
cert: fs.readFileSync(config.ssl.cert)
};
https.createServer(
options,
app.use('/', koop.server)
).listen(config.ssl.port || 443);
log.info("Koop MarkLogic Provider listening for HTTPS on ${config.ssl.port}");
}
koop.server.listen(config.port || 80);
const message = `
Koop MarkLogic Provider listening for HTTP on ${config.port}
Press control + c to exit
`
log.info(message)