8000 Cryptic error message on "setup-only" service. · Issue #285 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

Cryptic error message on "setup-only" service. #285

@HatiGamedev

Description

@HatiGamedev

Just noticed if you create a service with only a Service#setup(...) function and app.use(...) it.
You get a cryptic error message ( my guess - it's coming from express ), "Router.use() requires middleware function but got a Object".

Example:

// Error
const SomeService = {
    setup(app, path) {}
}
​
// No Error
​
const AnoterService = {
    setup(app, path) {},
    create(data, params, cb) {}
}
​
​
app.use('/some', SomeService); // cryptic error
app.use('/another', AnotherService); // Fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0