GithubHelp home page GithubHelp logo

Comments (11)

icebob avatar icebob commented on May 28, 2024 1

I will do it.

from moleculer-web.

icebob avatar icebob commented on May 28, 2024

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.

dani8art avatar dani8art commented on May 28, 2024

Yes, I think it would be a good solution.
Is it possible to do this?

from moleculer-web.

dani8art avatar dani8art commented on May 28, 2024

thank you!

from moleculer-web.

icebob avatar icebob commented on May 28, 2024

Is the blockDirectCall option name describes this feature? What do you think?

from moleculer-web.

dani8art avatar dani8art commented on May 28, 2024

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.

icebob avatar icebob commented on May 28, 2024

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.

dani8art avatar dani8art commented on May 28, 2024

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.

icebob avatar icebob commented on May 28, 2024

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.

Example

from moleculer-web.

dani8art avatar dani8art commented on May 28, 2024

Thank you very much!

from moleculer-web.

icebob avatar icebob commented on May 28, 2024

Released in v0.5.2

from moleculer-web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.