我有这个代码片段:
proxy('http://my-custom-api-endpoint.com', {
proxyReqOptDecorator(options) {
options.headers['x-forwarded-host'] = 'localhost:3000'
return options
}
})
这是对名为 proxy 的函数的调用,第一个参数是一个字符串,但第二个参数的语法我无法识别:
{
functionName(args) {
// statements
}
}
有人可以解释一下这种语法吗?