Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import express from '@feathersjs/express';
import socketio from '@feathersjs/socketio';
import middleware from './middleware';
import services from './services';
import appHooks from './app.hooks';
import channels from './channels';
// tslint:disable-next-line
const generatorSpecs = require('../feathers-gen-specs.json');
import authentication from './authentication';
import mongoose from './mongoose';
// !code: imports // !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(
// !code: helmet_config // !end
));
app.use(cors(
// !code: cors_config // !end
));
app.use(compress(
import express from '@feathersjs/express';
import socketio from '@feathersjs/socketio';
import middleware from './middleware';
import services from './services';
import appHooks from './app.hooks';
import channels from './channels';
// tslint:disable-next-line
const generatorSpecs = require('../feathers-gen-specs.json');
import authentication from './authentication';
import mongoose from './mongoose';
// !code: imports // !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
import feathers from '@feathersjs/feathers';
import configuration from '@feathersjs/configuration';
import express from '@feathersjs/express';
import socketio from '@feathersjs/socketio';
import { Application } from './declarations';
import logger from './logger';
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());
if (process.env.INSIGHTS_DATA) {
app.set('nedb', process.env.INSIGHTS_DATA)
}
// 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
import createModel from './todo'
// Initialize Knex
const knex = require('knex')({
client: 'sqlite3',
connection: {
filename: './db.sqlite'
},
useNullAsDefault: false
})
// Bind Objection.js
Model.knex(knex)
// Create a feathers instance.
const app = express(feathers())
// Enable REST services
.configure(rest())
// Turn on JSON parser for REST services
.use(bodyParser.json())
// Turn on URL-encoded parser for REST services
.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
import cors from 'cors';
import feathers from '@feathersjs/feathers';
import configuration from '@feathersjs/configuration';
import express from '@feathersjs/express';
import { Application } from './declarations';
import logger from './logger';
import middleware from './middleware';
import services from './services';
import appHooks from './app.hooks';
import channels from './channels';
import authentication from './authentication';
import mongoose from './mongoose';
// 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());
import feathers from '@feathersjs/feathers';
import configuration from '@feathersjs/configuration';
import express from '@feathersjs/express';
import socketio from '@feathersjs/socketio';
import swagger from 'feathers-swagger';
import { Application } from './declarations';
import logger from './logger';
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());
import feathers from '@feathersjs/feathers';
import configuration from '@feathersjs/configuration';
import express from '@feathersjs/express';
import socketio from '@feathersjs/socketio';
import middleware from './middleware';
import services from './services';
import appHooks from './app.hooks';
import channels from './channels';
// tslint:disable-next-line
const generatorSpecs = require('../feathers-gen-specs.json');
// !code: imports // !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 }));
// ! code: use_favicon
// Use favicon
export async function createApp (job, options = {}) {
debug('Initializing krawler application')
app = express(feathers())
// Enable CORS, security, compression, and body parsing
app.use(cors())
app.use(helmet())
app.use(compress())
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
const apiPrefix = (options.api ? options.apiPrefix : '')
debug('API prefix ' + apiPrefix)
app.configure(rest())
app.configure(socketio({
path: apiPrefix + 'ws',
transports: ['websocket']
}))
// Env var can be overridden by option
const sync = options.sync || process.env.SYNC_DB_URL
it('extends service params to batch calls and sets query', async () => {
const app = express(feathers());
app.use('/todos', {
get (id, params) {
return Promise.resolve({id, params});
}
});
app.use('/batch', batcher());
await runWithServer(
app,
async () => {
const data = await app.service('batch').create(
{
call: [
['todos::get', 1, {test: 'param1'}],
['todos::get', 3, {test: 'param2'}]
/**
* Resolve tag name
* @param {string} path - requested route
* @return {string} - tag name
* */
export function resolvePageName(path) {
const scope = process.pages.filter((page) => path.includes(page));
const fullPath = scope.sort((a, b) => a.length - b.length)[0];
const parts = (fullPath || path ).split('/').filter((e) => !!e);
const tagName = (parts.length ? parts.join('-') : 'index') + PAGE_SUFFIX;
return [tagName, fullPath];
};
const api = feathers();
const app = express(api);
api.MESSAGE = FrontLess.MESSAGE;
app.MESSAGE = FrontLess.MESSAGE;
app.PARSE = FrontLess.PARSE;
api.PARSE = FrontLess.PARSE;
app.UPDATE = FrontLess.UPDATE;
api.UPDATE = FrontLess.UPDATE;
/**
* FrontLess express middleware.
* Provides methods for parsing frontless HTTP requests and valid responces
* @param {Object} req - express request
* @param {Object} res - express response
* @param {Function} next - express callback
* @async
*/