moleculerjs / moleculer-web

:earth_africa: Official API Gateway service for Moleculer framework
http://moleculer.services/docs/moleculer-web.html
MIT License
291 stars 118 forks source link

added multiple REST routes in service settings #214

Closed mariusbackes closed 3 years ago

mariusbackes commented 3 years ago

In my application I need the possibility to define several REST routes for a service. With this change it is possible to define an array of routes.

settings: {
  rest: ["/route", "/route/multi"]
},

actions: {
  test: {
    rest: "GET /test"
    ...
  }
}

Both routes /route/test and /route/multi/test call the specific action.

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 528


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/index.js 56 57 98.25%
<!-- Total: 56 57 98.25% -->
Totals Coverage Status
Change from base Build 521: 0.2%
Covered Lines: 704
Relevant Lines: 727

💛 - Coveralls
mariusbackes commented 3 years ago

The test run for Node 8 is not sucessful because jest has dropped the node 8 support with the major release of 26.0.0. #9423

icebob commented 3 years ago

Cool, thanks! By the way, would be useful supporting multi REST config in action schema as well.

actions: {
  test: {
    rest: ["GET /test", "POST /test2"]
    ...
  }
}

Maybe do you have time to work on as well in this PR?

mariusbackes commented 3 years ago

I have added an array for each rest route. I have also updated the test cases

icebob commented 3 years ago

Awesome, thank, I will check it today.