@blueprod/ws-mvc-loader

This module is to support the traditional MVC model i.e. controller, service,...

Usage no npm install needed!

<script type="module">
  import blueprodWsMvcLoader from 'https://cdn.skypack.dev/@blueprod/ws-mvc-loader';
</script>

README

ws-mvc-loader

An utility module that supports to load the API definition is various structure and formats:

Your api structure should be (you could customize):

* api
   |--- config              -> containing the definition for the API routes
           |--- routes.js
           |--- routes.json 
   |--- controllers         -> containing the api handlers for defined routes
   |--- services            -> containing the business services for handling of the business logic
  

Notes:

  • Route files should be provided as glob pattern, for example, user-routes.js

Example of a Route file

{
  "routes": [
    {
      "method": "GET",
      "path": "/products",
      "handler": "product.list",
      "config": {
        "auth": false
      }
    },
    {
      "method": "GET",
      "path": "/products/count",
      "handler": "product.count",
      "config": {
        "auth": false
      }
    }
  ]
}