cors
This commit is contained in:
parent
38e4f74afb
commit
52cfb10ea1
7
index.js
7
index.js
@ -4,6 +4,11 @@ const express = require('express')
|
|||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
app.use(express.json())
|
app.use(express.json())
|
||||||
|
app.use(function(req, res, next) {
|
||||||
|
res.header("Access-Control-Allow-Origin", "*"); // update to match the domain you will make the request from
|
||||||
|
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
const { netId, rpcUrl, privateKey, mixerAddress, defaultGasPrice } = require('./config')
|
const { netId, rpcUrl, privateKey, mixerAddress, defaultGasPrice } = require('./config')
|
||||||
const { fetchGasPrice, isValidProof } = require('./utils')
|
const { fetchGasPrice, isValidProof } = require('./utils')
|
||||||
@ -54,7 +59,7 @@ app.post('/relay', async (req, resp) => {
|
|||||||
// TODO: nonce
|
// TODO: nonce
|
||||||
})
|
})
|
||||||
result.once('transactionHash', function(hash){
|
result.once('transactionHash', function(hash){
|
||||||
resp.send({ transaction: hash })
|
resp.json({ txHash: hash })
|
||||||
}).on('error', function(e){
|
}).on('error', function(e){
|
||||||
console.log(e)
|
console.log(e)
|
||||||
resp.status(400).send('Proof is malformed')
|
resp.status(400).send('Proof is malformed')
|
||||||
|
Loading…
Reference in New Issue
Block a user