Skip to content

Instantly share code, notes, and snippets.

@rzvdaniel
Created July 6, 2019 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rzvdaniel/ce8b1623ea6ade1f9522fb37496ee81d to your computer and use it in GitHub Desktop.
Save rzvdaniel/ce8b1623ea6ade1f9522fb37496ee81d to your computer and use it in GitHub Desktop.
[Medium] Moleculer Routing - Shorthand RESTful Aliases
const ApiGateway = require("moleculer-web");
module.exports = {
name: "api",
mixins: [ApiGateway],
settings: {
port: process.env.PORT || 3000,
routes: [{
path: "/shortrest",
// Shorthand RESTful aliases
aliases: {
"REST articles": "articles"
},
// Disable direct URLs (`/articles/list` or `/articles.list`)
mappingPolicy: "restrict",
whitelist: [
// Access any actions in 'articles' service
"articles.*"
]
}]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment