Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.configure(configuration());
// ! code: init_config
app.set('generatorSpecs', generatorSpecs);
// !end
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet(
// !code: helmet_config // !end
));
app.use(cors(
// !code: cors_config // !end
));
app.use(compress(
// !code: compress_config // !end
));
app.use(express.json(
// !code: json_config // !end
));
app.use(express.urlencoded(
// ! code: urlencoded_config
{ 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
app.configure(configuration());
// ! code: init_config
app.set('generatorSpecs', generatorSpecs);
// !end
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet(
// !code: helmet_config // !end
));
app.use(cors(
// !code: cors_config // !end
));
app.use(compress(
// !code: compress_config // !end
));
app.use(express.json(
// !code: json_config // !end
));
app.use(express.urlencoded(
// ! code: urlencoded_config
{ 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
// !code: init // !end
const app = express(feathers());
// !code: use_start // !end
// Load app configuration
app.configure(configuration());
// ! code: init_config
app.set('generatorSpecs', generatorSpecs);
// !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.ts`)
app.configure(middleware);
// Configure authentication (see `authentication.ts`)
app.configure(authentication);
// !code: init // !end
const app = express(feathers());
// !code: use_start // !end
// Load app configuration
app.configure(configuration());
// ! code: init_config
app.set('generatorSpecs', generatorSpecs);
// !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.js`)
app.configure(middleware);
app.configure(configuration());
// ! code: init_config
app.set('generatorSpecs', generatorSpecs);
// !end
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet(
// !code: helmet_config // !end
));
app.use(cors(
// !code: cors_config // !end
));
app.use(compress(
// !code: compress_config // !end
));
app.use(express.json(
// !code: json_config // !end
));
app.use(express.urlencoded(
// ! code: urlencoded_config
{ 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
const appHooks = require('./app.hooks');
const channels = require('./channels');
const authentication = require('./authentication');
const mongoose = require('./mongoose');
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')));
// Set up Plugins and providers
app.configure(express.rest());
app.configure(socketio());
app.configure(mongoose);
// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
app.configure(authentication);
// Set up our services (see `services/index.js`)
app.configure(services);
import middleware from './middleware';
import services from './services';
import appHooks from './app.hooks';
import channels from './channels';
import authentication from './authentication';
// Don't remove this comment. It's needed to format import lines nicely.
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',
function configureFeathers() {
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;
}
const app = feathersExpress(feathers());
const feathersServiceDummy = {
get : () => {
return Promise.resolve({});
},
find : () => {
return Promise.resolve([{}, {}]);
}
};
const expressMiddlewareDummy = (req: express.Request, res: express.Response, next: express.NextFunction) => {
next();
return app;
};
app.use(express.json());
app.use(express.urlencoded({extended : true}));
app.use('/', express.static('./public'));
app.use('/', expressMiddlewareDummy, feathersServiceDummy);
app.configure(express.rest());
app.use(express.notFound());
app.use(express.errorHandler({logger : console}));
app.MESSAGE = FrontLess.MESSAGE;
app.PARSE = FrontLess.PARSE;
api.PARSE = FrontLess.PARSE;
app.UPDATE = FrontLess.UPDATE;
api.UPDATE = FrontLess.UPDATE;
const sessionMiddleware = session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: true,
cookie: {secure: false},
})
app.use(cors());
app.use(sessionMiddleware);
app.use(express.json());
app.use(express.urlencoded({extended: true}));
app.configure(express.rest());
app.configure(socketio({}, function(io) {
io.use(function(socket, next) {
sessionMiddleware(socket.request, socket.request.res, next);
});
io.use(function(socket, next) {
socket.feathers.request = socket.request;
next();
});
}));
app.configure(authentication({
session: true,
secret: '123sd234sdfsdf',
service: 'users',
}));