-
Notifications
You must be signed in to change notification settings - Fork 25
Add the ability for services to be internal only. #23
Comments
I think what you are asking for is already possible using the disable hook. The disable hook allows to disable access to all or specific service methods for all or specific external providers or to disable it completely: const hooks = require('feathers-hooks');
app.service('users').before({
// Users can not be created by external access
create: hooks.disable('external'),
// A user can not be deleted through the REST provider
remove: hooks.disable('rest'),
// Disable calling `update` completely (e.g. to only support `patch`)
update: hooks.disable()
}); |
Oh yes I see now. Apologies, I should have read the docs more closely. Thanks! |
It's a great question and granted, it is a little hidden. I created a follow-up issue in feathersjs-ecosystem/docs#93 and will add it to the FAQ. |
Hello, i have got one simiral issue.
TestService
In my application i am using
I do not have got user authentication my application can have any visitors. |
I would remove the sub-app setup and just add the |
What u mean remove sub-app? you mean i have to remove const app = express(); ? |
disable is DEPRECATED, so change with disallowed
|
The service and hooks abstraction in feathers is awesome and really powerful. So much in fact, that I want to use it more extensively. I want to be able to create internal only services that have useful server side logic like a file storage service or a field validator service.
The problem becomes that I have to expose that service's CRUD methods as rest methods. I don't necessarily want to do that. So far I have taken to namespacing my internal services with an service_name. This is obviously not an ideal solution.
Having peeked into the logic that hooks a service up to express, it seems like it wouldn't be hard to just skip that part if some flag is set on the service, or if the name is service_name or some other construct.
Thanks!
The text was updated successfully, but these errors were encountered: