mirror of
https://github.com/tornadocash/tornado-relayer.git
synced 2024-10-01 08:25:37 -04:00
fix cors
This commit is contained in:
parent
68f25d7d57
commit
e964e5135a
@ -8,6 +8,13 @@ const { isAddress } = require('web3-utils')
|
|||||||
const app = express()
|
const app = express()
|
||||||
app.use(express.json())
|
app.use(express.json())
|
||||||
|
|
||||||
|
// Add CORS headers
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
res.header('Access-Control-Allow-Origin', '*')
|
||||||
|
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
|
||||||
// Log error to console but don't send it to the client to avoid leaking data
|
// Log error to console but don't send it to the client to avoid leaking data
|
||||||
app.use((err, req, res, next) => {
|
app.use((err, req, res, next) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -17,13 +24,6 @@ app.use((err, req, res, next) => {
|
|||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
||||||
// Add CORS headers
|
|
||||||
app.use((req, res, next) => {
|
|
||||||
res.header('Access-Control-Allow-Origin', '*')
|
|
||||||
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
|
|
||||||
next()
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/', status.index)
|
app.get('/', status.index)
|
||||||
app.get('/v1/status', status.status)
|
app.get('/v1/status', status.status)
|
||||||
app.get('/v1/jobs/:id', status.getJob)
|
app.get('/v1/jobs/:id', status.getJob)
|
||||||
|
Loading…
Reference in New Issue
Block a user