Eventvisor

Advanced

Parsers

Eventvisor ships with built-in parsers supporting YAML and JSON files. You can also take advantage of custom parsers API allowing you to manage your projects in a language you are most comfortable with.

Built-in parsers

YAML

By default, Eventvisor assumes all your definitions are written in YAML and no extra configuration is needed in that case:

eventvisor.config.js
module.exports = {
tags: ['web'],
// optional if value is "yml"
parser: 'yml',
}

You can find a example project using YAML here.

JSON

If we wish to use JSON files instead of YAMLs, we can do so by specifying the parser option:

eventvisor.config.js
module.exports = {
tags: ['web'],
// define the parser to use
parser: 'json',
}

You can find a example project using JSON here.

Custom

If you wish to define your events and attributes in some other language besides YAML and JSON, you can provide your own custom parser.

A parser in this case is a function that takes file content as input (string) and returns a parsed object.

Let's say we wish to use TOML files for our definitions.

We start by installing the toml package:

Command
$ npm install --save-dev toml

Now we define a custom parser in our configuration:

eventvisor.config.js
module.exports = {
tags: ['web'],
// define the parser to use
parser: {
extension: 'toml',
parse: (content) => require('toml').parse(content),
},
}
Previous
Tags