Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// !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
// Set up Plugins and providers
// !code: config_start // !end
default: 2,
max: 4
},
esVersion: db.getApiVersion(),
elasticsearch: db.getServiceConfig('todos')
});
// Create a feathers instance.
let app = express(feathers())
.configure(rest())
// Enable Socket.io services
.configure(socketio())
// Turn on JSON parser for REST services
.use(express.json())
// Turn on URL-encoded parser for REST services
.use(express.urlencoded({ extended: true }))
.use('/todos', todoService);
module.exports = app;
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.js`)
app.configure(middleware);
// Set up our services (see `services/index.js`)
app.configure(services);
// Set up event channels (see channels.js)
const app = express(feathers());
// !code: use_start // !end
// Load app configuration
app.configure(configuration());
// ! code: init_config
app.set('generatorSpecs', generatorSpecs);
// !end
// 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')));
// !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)
// !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
// Set up Plugins and providers
// !code: config_start // !end
const path = require('path');
const feathers = require('@feathersjs/feathers');
const express = require('@feathersjs/express');
const socketio = require('@feathersjs/socketio');
// Heroku will set the PORT environment variable. Otherwise use 3030
const port = process.env.PORT || 3030;
// Creates an Express compatible Feathers application
const app = express(feathers());
app.use('/', express.static(path.join(__dirname, '..', 'public')));
// Parse HTTP JSON bodies
app.use(express.json());
// Parse URL-encoded params
app.use(express.urlencoded({ extended: true }));
// Add REST API support
app.configure(express.rest());
// Configure Socket.io real-time APIs
app.configure(socketio());
// Register a messages service with pagination
app.use('/messages', {
async get (id) {
return { id };
}
});
// Register a nicer error handler than the default Express one
app.use(express.errorHandler());
// Start the server
app.listen(port).on('listening', () =>
console.log(`Feathers server listening on localhost:${port}`)
const blobStore = Store({
client: s3,
bucket: 'feathers-blob-store'
});
const blobService = BlobService({
Model: blobStore
});
// Create a feathers instance.
var app = express(feathers())
// Turn on JSON parser for REST services
.use(express.json())
// Turn on URL-encoded parser for REST services
.use(express.urlencoded({ extended: true }))
.use('/blobs', blobService);
// A basic error handler, just like Express
app.use(function (error, req, res, next) {
res.json(error);
});
// Start the server
module.exports = app.listen(3030);
console.log('feathers-blob-store service running on 127.0.0.1:3030');
const app = express(feathers());
// !code: use_start // !end
// Load app configuration
app.configure(configuration());
// ! code: init_config
app.set('generatorSpecs', generatorSpecs);
// !end
// 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')));
// !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);
// Set up our services (see `services/index.ts`)
const services = require('./services')
const appHooks = require('./app.hooks')
const channels = require('./channels')
const authentication = require('./authentication')
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)
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}));