pretty curious about this. your help is appreciated.
If you mean to use feathers as a sub app within an express server then you can do so by something like:
// server.js
import express from 'express';
import bodyParser from 'body-parser';
import api from './api';
const app = express();
const init = () => {
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use('/api', api);
const server = app.listen(3001);
api.setup(server);
};
export const run = () => init();
// api.js
import feathers from 'feathers';
import rest from 'feathers-rest';
import sequelize from 'feathers-sequelize';
import socketio from 'feathers-socketio';
const db = require('../feathers/models');
const api = feathers();
api.configure(socketio());
api.configure(rest());
api.use('/film', sequelize({
Model: db.film,
id: 'film_id',
paginate: {
default: 10,
max: 25
}
}));
export default api;
Now you can access the above at /api/film.
wow thanks ill give it a try.
This works fully with the REST or Socket.IO feathers-client as well, and not just as URLs you can access on browser.
// client.js
import feathers from 'feathers/client';
import socketio from 'feathers-socketio/client';
import io from 'socket.io-client';
const host = 'http://localhost:3001';
const client = feathers().configure(socketio(io(host)));
export const filmService = client.service('/api/film');
export default client;
Thanks @zusamann that's exactly it.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.
Most helpful comment
If you mean to use feathers as a sub app within an express server then you can do so by something like:
Now you can access the above at
/api/film.