mirror of
https://github.com/oceanprotocol/webtasks
synced 2025-01-08 21:04:03 +01:00
prototype Zoho proxy
This commit is contained in:
parent
1c8795a27a
commit
d9946926fa
@ -3,11 +3,13 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "wt serve webtask-medium.js",
|
"start": "wt serve webtask-zoho.js",
|
||||||
"test": "eslint ./{src,public}/**/*.js"
|
"test": "eslint ./{src,public}/**/*.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"cors": "^2.8.4",
|
||||||
"express": "^4.16.3",
|
"express": "^4.16.3",
|
||||||
|
"http-proxy-middleware": "^0.18.0",
|
||||||
"request": "^2.85.0",
|
"request": "^2.85.0",
|
||||||
"webtask-tools": "^3.2.0"
|
"webtask-tools": "^3.2.0"
|
||||||
},
|
},
|
||||||
|
21
webtask-zoho.js
Normal file
21
webtask-zoho.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
const express = require('express')
|
||||||
|
const Webtask = require('webtask-tools')
|
||||||
|
const cors = require('cors')
|
||||||
|
const proxy = require('http-proxy-middleware')
|
||||||
|
|
||||||
|
const server = express()
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
target: 'https://www.zohoapis.com/crm/v2/',
|
||||||
|
changeOrigin: true,
|
||||||
|
headers: {
|
||||||
|
Authorization: 'Zoho-oauthtoken hello'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server.use(cors())
|
||||||
|
server.use('*', proxy(config))
|
||||||
|
|
||||||
|
server.listen(4430)
|
||||||
|
|
||||||
|
module.exports = Webtask.fromExpress(server)
|
Loading…
Reference in New Issue
Block a user