I tried to create an object and wanted to set some fields by calling other fields. I get error
base: `${this.api.foo.domain}${this.api.foo.port}${this.api.foo.version}`,
^
TypeError: Cannot read property 'foo' of undefined
code:
module.exports = {
api: {
foo: {
domain: 'api.foo.com',
port: ':8080',
version: '/v1',
base: `${this.api.foo.domain}${this.api.foo.port}${this.api.foo.version}`,
verifyToken: `${this.api.foo.base}/oauth/token/{bearerToken}`,
}
}
};
How can I call fields properly?