Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Configure database adapters
app.configure(mongoose);
// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
// Configure authentication (see `authentication.js`)
app.configure(authentication);
// Set up our services (see `services/index.js`)
app.configure(services);
// Set up event channels (see channels.js)
app.configure(channels);
// !code: config_middle // !end
// Configure a middleware for 404s and the error handler
app.use(express.notFound());
app.use(express.errorHandler({ logger }));
// !code: config_end // !end
app.hooks(appHooks);
const moduleExports = app;
// !code: exports // !end
module.exports = moduleExports;
// !code: funcs // !end
// !code: end // !end
// Configure database adapters
app.configure(mongodb);
// Configure other middleware (see `middleware/index.ts`)
app.configure(middleware);
// Configure authentication (see `authentication.ts`)
app.configure(authentication);
// Set up our services (see `services/index.ts`)
app.configure(services);
// Set up event channels (see channels.ts)
app.configure(channels);
// !code: config_middle // !end
// Configure a middleware for 404s and the error handler
app.use(express.notFound());
app.use(express.errorHandler({ logger }));
// !code: config_end // !end
app.hooks(appHooks);
const moduleExports = app;
// !code: exports // !end
export default moduleExports;
// !code: funcs // !end
// !code: end // !end
// !code: express_socketio // !end
));
// Configure database adapters
app.configure(mongodb);
// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
// Set up our services (see `services/index.js`)
app.configure(services);
// Set up event channels (see channels.js)
app.configure(channels);
// !code: config_middle // !end
// Configure a middleware for 404s and the error handler
app.use(express.notFound());
app.use(express.errorHandler({ logger }));
// !code: config_end // !end
app.hooks(appHooks);
const moduleExports = app;
// !code: exports // !end
module.exports = moduleExports;
// !code: funcs // !end
// !code: end // !end
// Configure database adapters
app.configure(sequelize);
// Configure other middleware (see `middleware/index.ts`)
app.configure(middleware);
// Configure authentication (see `authentication.ts`)
app.configure(authentication);
// Set up our services (see `services/index.ts`)
app.configure(services);
// Set up event channels (see channels.ts)
app.configure(channels);
// !code: config_middle // !end
// Configure a middleware for 404s and the error handler
app.use(express.notFound());
app.use(express.errorHandler({ logger }));
// !code: config_end // !end
app.hooks(appHooks);
const moduleExports = app;
// !code: exports // !end
export default moduleExports;
// !code: funcs // !end
// !code: end // !end
app.configure(socketio());
// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
// Set up our services (see `services/index.js`)
app.configure(services);
// Set up event channels (see channels.js)
app.configure(channels);
// Configure authentication (see `authentication.js`)
app.configure(authentication);
// !code: config_middle // !end
// Configure a middleware for 404s and the error handler
app.use(express.notFound());
app.use(express.errorHandler({ logger }));
// !code: config_end // !end
app.hooks(appHooks);
const moduleExports = app;
// !code: exports // !end
module.exports = moduleExports;
// !code: funcs // !end
// !code: end // !end
));
app.configure(socketio(
// !code: express_socketio // !end
));
// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
// Set up our services (see `services/index.js`)
app.configure(services);
// Set up event channels (see channels.js)
app.configure(channels);
// !code: config_middle // !end
// Configure a middleware for 404s and the error handler
app.use(express.notFound());
app.use(express.errorHandler({ logger }));
// !code: config_end // !end
app.hooks(appHooks);
const moduleExports = app;
// !code: exports // !end
module.exports = moduleExports;
// !code: funcs // !end
// !code: end // !end
.use(bodyParser.urlencoded({ extended: true }))
app.set('knex', knex)
// Create service
app.use('/todos', createService({
model: createModel(app),
id: 'id',
paginate: {
default: 2,
max: 4
}
}))
// Handle Errors
app.use(errorHandler())
// Start the server
module.exports = app.listen(3030)
console.log('Feathers Todo Objection service running on 127.0.0.1:3030')
const feathers = require("@feathersjs/feathers");
const express = require("@feathersjs/express");
const app = express(feathers());
// Turn on JSON body parsing for REST services
app.use(express.json());
// Turn on URL-encoded body parsing for REST services
app.use(express.urlencoded({ extended: true }));
// Set up REST transport using Express
app.configure(express.rest());
// Set up an error handler that gives us nicer errors
app.use(express.errorHandler());
return app;
}
// Configure database adapters
app.configure(mongoose);
// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
// Set up our services (see `services/index.js`)
app.configure(services);
// Set up event channels (see channels.js)
app.configure(channels);
// Configure authentication (see `authentication.js`)
app.configure(authentication);
// !code: config_middle // !end
// Configure a middleware for 404s and the error handler
app.use(express.notFound());
app.use(express.errorHandler({ logger }));
// !code: config_end // !end
app.hooks(appHooks);
const moduleExports = app;
// !code: exports // !end
module.exports = moduleExports;
// !code: funcs // !end
// !code: end // !end
app.configure(configuration());
// Enable CORS, security, compression, favicon and body parsing
app.use(cors());
app.use(helmet());
app.use(compress());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// Host the public folder
app.use('/', express.static(app.get('public')));
app.configure(express.rest());
app.configure(socketio());
app.configure(distribution({
hooks: { before: { all: [authenticate('jwt')] } },
middlewares: { after: express.errorHandler() }
}));
// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
app.configure(authentication);
// Set up our services (see `services/index.js`)
app.configure(services);
// Set up channels
app.configure(channels);
// Configure a middleware for 404s and the error handler
// FIXME: this does not allow to declare remote services after the app has been launched
// Indeed this middleware is hit first...
//app.use(express.notFound());
//app.use(express.errorHandler());
app.hooks(appHooks);