Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{ extended: true }
// !end
));
// ! code: use_favicon
// Use favicon
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// !end
// ! code: use_static
// Host the public folder
app.use('/', express.static(app.get('public')));
// !end
// !code: use_end // !end
// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest(
// !code: express_rest // !end
));
app.configure(socketio(
// !code: express_socketio // !end
));
// Configure database adapters
app.configure(mongoose);
// 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);
{ extended: true }
// !end
));
// ! code: use_favicon
// Use favicon
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// !end
// ! code: use_static
// Host the public folder
app.use('/', express.static(app.get('public')));
// !end
// !code: use_end // !end
// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest(
// !code: express_rest // !end
));
app.configure(socketio(
// !code: express_socketio // !end
));
// 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
// !end
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet());
app.use(cors());
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')));
// !code: use_end // !end
// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest());
app.configure(socketio());
// 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
// !end
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet());
app.use(cors());
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')));
// !code: use_end // !end
// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest());
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);
// !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
const app = express(feathers())
// Load app configuration
app.configure(configuration())
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet())
app.use(cors())
app.use(compress())
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
app.use(favicon(__dirname + '../../../dist/pwa-mat/statics/icons/favicon-32x32.png'))
// Host the public folder
app.use('/', express.static( __dirname + '../../../dist/pwa-mat' ))
// Set up Plugins and providers
app.configure(express.rest())
app.configure(socketio())
// 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 event channels (see channels.js)
app.configure(channels)
// Configure a middleware for 404s and the error handler
app.use(express.notFound())
app.use(express.errorHandler({ logger }))
app.hooks(appHooks)
}
// Load app configuration
app.configure(settings);
// 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('/public', express.static(app.get('public')));
// Set up Plugins and providers
app.configure(express.rest());
app.configure(socketio());
app.configure(sequelize);
/* Configure the authentication provider via @feathersjs/authentication-jwt and
* passport-jwt (https://github.com/themikenicholson/passport-jwt)
*/
const authConfig = app.get('jwt');
app.configure(authentication({
name: authConfig.name,
service: 'registration',
secret: process.env.EVERGREEN_JWT_SECRET || authConfig.secret,
}));
app.configure(jwt({
jsonWebTokenOptions: {
// !end
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet());
app.use(cors());
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')));
// !code: use_end // !end
// Set up Plugins and providers
// !code: config_start // !end
app.configure(express.rest());
app.configure(socketio());
// Configure database adapters
app.configure(mongoose);
// 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
constructor() {
const app = express(feathers());
this.app = app;
app.configure(configuration());
app.configure(express.rest());
app.configure(socketio());
app.use('messages', new MessageService(app));
/*
* Set up the socket.io channel
*/
app.on('connection', conn => this.app.channel('anonymous').join(conn));
// Publish all events into the anonymous channel
app.publish(() => app.channel('anonymous'));
}
const app: Application = express(feathers());
// Load app configuration
app.configure(configuration());
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet());
app.use(cors());
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')));
// Set up Plugins and providers
app.configure(express.rest());
app.configure(socketio());
app.configure(
swagger({
docsPath: '/api/docs',
uiIndex: true,
specs: {
info: {
title: 'Home Panel API',
description: 'API for Home Panel',
version: '2.0.0'
}
}
})
);
// Configure other middleware (see `middleware/index.js`)
const { authenticate } = require('@feathersjs/authentication').hooks;
const app = express(feathers());
// Load app configuration
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...