mirror of
https://github.com/Xahau/Validation-Ledger-Tx-Store-to-xPOP.git
synced 2025-11-20 11:45:51 +00:00
Deal with CORS
This commit is contained in:
@@ -4,6 +4,7 @@ import express from 'express'
|
|||||||
import expressWs from 'express-ws'
|
import expressWs from 'express-ws'
|
||||||
import autoindex from 'express-autoindex/dist/index.cjs.js'
|
import autoindex from 'express-autoindex/dist/index.cjs.js'
|
||||||
import nunjucks from 'nunjucks'
|
import nunjucks from 'nunjucks'
|
||||||
|
import cors from 'cors'
|
||||||
import 'dotenv/config'
|
import 'dotenv/config'
|
||||||
|
|
||||||
import { lastLedger } from '../lib/onLedger.mjs'
|
import { lastLedger } from '../lib/onLedger.mjs'
|
||||||
@@ -35,6 +36,7 @@ if (!wss) {
|
|||||||
// })
|
// })
|
||||||
|
|
||||||
app.use('/',
|
app.use('/',
|
||||||
|
cors(),
|
||||||
(req, res, next) => {
|
(req, res, next) => {
|
||||||
if (req.url.split('?')?.[0].match(/\.json$/i)) {
|
if (req.url.split('?')?.[0].match(/\.json$/i)) {
|
||||||
res.setHeader('content-type', 'application/json')
|
res.setHeader('content-type', 'application/json')
|
||||||
|
|||||||
Reference in New Issue
Block a user