mirror of
https://github.com/oceanprotocol/webtasks
synced 2024-11-24 02:55:13 +01:00
handle CRM & Campaigns API
This commit is contained in:
parent
d9946926fa
commit
e0ddc2f3cf
@ -5,16 +5,28 @@ const proxy = require('http-proxy-middleware')
|
|||||||
|
|
||||||
const server = express()
|
const server = express()
|
||||||
|
|
||||||
const config = {
|
const onProxyReq = function (proxyReq, req) {
|
||||||
target: 'https://www.zohoapis.com/crm/v2/',
|
proxyReq.setHeader('Authorization', `Zoho-oauthtoken ${req.webtaskContext.secrets.ZOHO_TOKEN}`)
|
||||||
changeOrigin: true,
|
|
||||||
headers: {
|
|
||||||
Authorization: 'Zoho-oauthtoken hello'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const configZohoCRM = {
|
||||||
|
target: 'https://www.zohoapis.com/crm/v2/',
|
||||||
|
pathRewrite: { '^/zoho/crm/': '/' },
|
||||||
|
changeOrigin: true,
|
||||||
|
onProxyReq
|
||||||
|
}
|
||||||
|
|
||||||
|
const configZohoCampaigns = {
|
||||||
|
target: 'https://campaigns.zoho.com/api/',
|
||||||
|
pathRewrite: { '^/zoho/campaigns/': '/' },
|
||||||
|
changeOrigin: true,
|
||||||
|
onProxyReq
|
||||||
}
|
}
|
||||||
|
|
||||||
server.use(cors())
|
server.use(cors())
|
||||||
server.use('*', proxy(config))
|
// server.use('*', proxy(config))
|
||||||
|
server.use(proxy('/zoho/crm/**', configZohoCRM))
|
||||||
|
server.use(proxy('/zoho/campaigns/**', configZohoCampaigns))
|
||||||
|
|
||||||
server.listen(4430)
|
server.listen(4430)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user