mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2025-09-09 02:40:40 +00:00
proxy for cors
This commit is contained in:
11
proxy.mjs
Normal file
11
proxy.mjs
Normal file
@@ -0,0 +1,11 @@
|
||||
import httpProxy from 'http-proxy'
|
||||
import http from 'http'
|
||||
|
||||
const proxy = httpProxy.createProxyServer({})
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
const target = req.url.startsWith('/api/') ? 'http://localhost:5000' : 'http://localhost:3000'
|
||||
proxy.web(req, res, { target })
|
||||
})
|
||||
|
||||
server.listen(1234)
|
Reference in New Issue
Block a user