Base Usage
Configuration
It is possible to configure Mimus Serve via a configuration. Sometimes it could be easier than using the command line. Some parameters are only available using the configuration file.
Syntax
The configuration file must be in the YAML format and follow this structure:
port: set the port number to listen to. For instance, 3000. Defaults to4000.host: The host or IP adress to bind to. Defaults tolocalhost.logger: The logger level to use. If this parameter is not specified no logging is done. Logger values can beerror,warn,info,debug.files: set the path from which to find files referenced with bodyFileName. Default to./files.mappings: set the path from which to find mapping files. All files with extension*.jsonor*.yamlare read to build the mapping configuration. Default to./mapping.datasets: set the path from which to find dataset files. All files with extension*.json,*.ymlor*.yamlare read to create datasets. The name of the file will be the dataset name. Default to./datasets.transform: Force template expansion (handlebars) for all mappings.cors: The cors configuration (optional)cors.origin: can be eitherfalse,true,*, a string or a list of hosts -falseno cors configuration is put in place. -truecors is active and to reflect the request origin. -*cors configuration is active and allows any origin - A string to allow a specific origin - A list to allow an array of valid originscors.method: Configures the Access-Control-Allow-Methods CORS header. Expects a comma-delimited string (ex: 'GET,PUT,POST') or an array (ex: ['GET', 'PUT', 'POST']).cors.allowedHeaders: Configures the Access-Control-Allow-Headers CORS header. Expects a comma-delimited string (ex: 'Content-Type,Authorization')cors.exposedHeaders: Configures the Access-Control-Expose-Headers CORS header. Expects a comma-delimited string (ex: 'Content-Range,X-Content-Range')cors.credentials: Configures the Access-Control-Allow-Credentials CORS header. Set to true to pass the header, otherwise it is omitted.cors.maxAge: Configures the Access-Control-Max-Age CORS header. In seconds. Set to an integer to pass the header, otherwise it is omitted.
The cors configuration is mapping almost exactly to fastify-cors configuration.