How to use the @feathersjs/express.static function in @feathersjs/express

To help you get started, we’ve selected a few @feathersjs/express examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github feathers-plus / generator-feathers-plus / test / cumulative-2-sequelize-services.test-expected / src1 / app.js View on Github external
// 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);
// Configure authentication (see `authentication.js`)
app.configure(authentication);
// Set up our services (see `services/index.js`)
app.configure(services);
github feathers-plus / generator-feathers-plus / test-expands / cumulative-1-mongo.test-expected / src1 / app.js View on Github external
));
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
app.configure(express.rest(
  // !code: express_rest // !end
));
app.configure(socketio(
  // !code: express_socketio // !end
));
// Configure database adapters
app.configure(mongodb);

// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
github feathers-plus / generator-feathers-plus / test-expands / ts-cumulative-1-mongo.test-expected / src1 / app.ts View on Github external
));
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
app.configure(express.rest(
  // !code: express_rest // !end
));
app.configure(socketio(
  // !code: express_socketio // !end
));
// Configure database adapters
app.configure(mongodb);

// Configure other middleware (see `middleware/index.ts`)
app.configure(middleware);
github feathers-plus / generator-feathers-plus / test / cumulative-1-mongoose.test-expected / src1 / app.js View on Github external
// 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(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);
github timmo001 / home-panel / api / src / app.ts View on Github external
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',
        version: '2.0.0'
      }
    }
  })
github kalisio / feathers-distributed / example / service / src / app.js View on Github external
const appHooks = require('./app.hooks');
const channels = require('./channels');

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());

// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
// 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(notFound());
app.use(handler());
github claustres / quasar-feathers-tutorial / quasar-feathers / api / src / server.js View on Github external
constructor() {
    this.app = express(feathers())
    // Load app configuration
    this.app.configure(configuration(path.join(__dirname, '..')))

    // Serve pure static assets
    if (process.env.NODE_ENV === 'production') {
      this.app.use(this.app.get('client').build.publicPath, express.static('../dist'))
    }
    else {
      const staticsPath = path.posix.join(this.app.get('client').dev.publicPath, 'statics/')
      this.app.use(staticsPath, express.static('../client/statics'))
    }

    // Define HTTP proxies to your custom API backend. See /config/index.js -> proxyTable
    // https://github.com/chimurai/http-proxy-middleware
    Object.keys(this.app.get('proxyTable')).forEach( (context) => {
      let options = this.config.this.app.get('proxyTable')[context]
      if (typeof options === 'string') {
        options = { target: options }
      }
      this.app.use(proxyMiddleware(context, options))
    })
github nesterow / frontless / components / server.js View on Github external
origin: corsResolver,
});

const api = feathers()
const app = express(api)

app.emit('setup', app)

app.use(cookieParser())
app.use(corsMiddleware)
app.use(sessionMiddleware)
app.use(express.json())
app.use(express.urlencoded({extended: true}))
app.configure(express.rest())
app.use('/assets', express.static('assets'))
app.use('/worker.js', express.static('assets/worker.js'))
app.use('/boot.js', express.static('assets/boot.js'))

app.use((req, res, next) => {
  const token = req.cookies [COOKIE_NAME]
  app.passport.verifyJWT(token, {
    secret: REST_AUTH_SECRET || 'secret',
  }).

  then((user) => {
    req.session.authenticated = true
    req.session.user = user
    req.session.save()
    next()
  }).

  catch((err)=> {
github nesterow / frontless / src / server.js View on Github external
})

app.use(helmet());

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.use('/assets', express.static('assets'))
app.use(corsMiddleware)
app.use(sessionMiddleware)
app.use(express.json())
app.use(express.urlencoded({extended: true}))

app.configure(express.rest())

app.configure(authentication({
  session: true,
  secret: process.env.REST_AUTH_SECRET,
  service: process.env.REST_AUTH_SERVICE,
}))

app.configure(local())

app.use(function (req, res, next) {
github jenkins-infra / evergreen / distribution / client / src / lib / ui.ts View on Github external
serve() {
    this.app.use('/', express.static(this.app.get('public')));
    this.app.use(express.notFound());
    this.server = this.app.listen(this.app.get('port'));
    return this;
  }
}