API Configuration

Setting up an API Application

In order to configure API Application you should to pass the options parameter to the merest.ModelAPIExpress contructor:

const api = new merest.ModelAPIExpress({
  title: 'Merest-Sample API',
  path: '/api/v1',
  host: 'localhost:8000',
  options: false,
  transformResponse: <function>
});

Avaliable parameters are:

  • title: String - The title of API. <SWAGGER>
  • version: String - The version of API. <SWAGGER>
  • path: String - The path of api root. The application doesn't mount it self on this path. <SWAGGER>
  • host: String - The host to reach API. <SWAGGER>
  • options: Boolean - allows or denies the OPTION end-point on the application level
  • transformResponse: Function - the function to transform standard response. For details see Transform response

<SWAGGER> - the parameter is mandatory for correct swagger support



Next (Installation) >