Comments (11)
I will do it.
from moleculer-web.
Hi,
it's true, because alias is just an alias/shorthand for actions. It doesn't block anything.
Do you need a route option which blocks all URLs except the aliases?
from moleculer-web.
Yes, I think it would be a good solution.
Is it possible to do this?
from moleculer-web.
thank you!
from moleculer-web.
Is the blockDirectCall
option name describes this feature? What do you think?
from moleculer-web.
Yes, I think it would be a good name, it describes the feature.
If you allow me, I would like to propose you mappingPolicy
.
{
mappingPolicy: 'restrict' #Only aliases will be mapped
}
...
{
mappingPolicy: 'include' #Only [aliase] xor [direct]. I don't know if it would be better 'xor'
}
...
{
mappingPolicy: 'all' # [aliases] union [direct]
}
What do you think?
from moleculer-web.
mappingPolicy
is good. I like it. But I don't understand the include
option. Do you have a use case for it?
from moleculer-web.
include
or xor
I don't know how to name this value. I want to describe the following use case:
You have 3 actions:
books.create
books.get
books.info
and you want to add aliases to books.create
and books.get
, but you want to map all of them.
{
mappingPolicy: 'include',
aliases: {
'GET books': 'books.get',
'POST books': 'books.create'
}
}
And the result will be:
-
/books
- POST
- GET
-
/books/info
- POST
- GET
- UPDATE
- DELETE
- ...
from moleculer-web.
Thanks. I added mappingPolicy
with all
and restrict
. Currently the include
is not implemented, it is not too easy. I'm still thinking about it.
from moleculer-web.
Thank you very much!
from moleculer-web.
Released in v0.5.2
from moleculer-web.
Related Issues (20)
- Q&A: How can I remove the service name from the api endpoint? HOT 6
- Could not handle the request when the request come with files and data in multipart HOT 2
- Sometime the list of REST api is missing some functions HOT 1
- multipartHandler throws unhandled error if payload is too large
- CORS Preflight Issue HOT 2
- Response headers affectation HOT 2
- Missing interface when upload file. HOT 2
- resetTime should accept function
- Undefined `actions` property in `/api/~node/services?withActions=true` causes empty REST API page HOT 1
- Route-level `mergeParams` doesn't exist for auto aliases HOT 1
- Cannot skip route with middleware HOT 1
- Improve routes priorization HOT 1
- RateLimit didn't check if trusted proxy send the header x-forwarded-for HOT 4
- REST shortcut doesn't handle action object correctly
- Typescript error: import { IParseOptions } from 'qs'
- Can we get an official interface for ctx.meta.$ fields available in moleculer-web?
- Routes with autoAliases not considered for started HOT 1
- Allow define action type in auto aliases (rest action param) HOT 2
- What is the benefit of using ctx.meta.$location & ctx.meta.$responseType vs just setting via ctx.meta.$responseHeaders? HOT 4
- update request body value in onBeforeCall hook not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moleculer-web.