feat: remove csrf
This commit is contained in:
@@ -16,8 +16,6 @@ import { Server } from "socket.io";
|
|||||||
import { readdirSync } from "fs"
|
import { readdirSync } from "fs"
|
||||||
import { fork } from 'child_process';
|
import { fork } from 'child_process';
|
||||||
|
|
||||||
const csrfProtection = csrf({ cookie: true })
|
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(cors({
|
app.use(cors({
|
||||||
origin: 'http://localhost:3000',
|
origin: 'http://localhost:3000',
|
||||||
@@ -39,10 +37,9 @@ export const io = new Server(server);
|
|||||||
export const browserPool = new BrowserPool();
|
export const browserPool = new BrowserPool();
|
||||||
|
|
||||||
app.use(bodyParser.json({ limit: '10mb' }))
|
app.use(bodyParser.json({ limit: '10mb' }))
|
||||||
app.use(bodyParser.urlencoded({ extended: true, limit: '10mb', parameterLimit: 10000 }));
|
app.use(bodyParser.urlencoded({ extended: true, limit: '10mb', parameterLimit: 9000 }));
|
||||||
// parse cookies - "cookie" is true in csrfProtection
|
// parse cookies - "cookie" is true in csrfProtection
|
||||||
app.use(cookieParser())
|
app.use(cookieParser())
|
||||||
app.use(csrfProtection)
|
|
||||||
|
|
||||||
app.use('/record', record);
|
app.use('/record', record);
|
||||||
app.use('/workflow', workflow);
|
app.use('/workflow', workflow);
|
||||||
@@ -62,24 +59,20 @@ readdirSync(path.join(__dirname, 'api')).forEach((r) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const workerProcess = fork(path.resolve(__dirname, './worker.ts'));
|
const workerProcess = fork(path.resolve(__dirname, './worker.ts'));
|
||||||
workerProcess.on('message', (message) => {
|
workerProcess.on('message', (message) => {
|
||||||
console.log(`Message from worker: ${message}`);
|
console.log(`Message from worker: ${message}`);
|
||||||
});
|
});
|
||||||
workerProcess.on('error', (error) => {
|
workerProcess.on('error', (error) => {
|
||||||
console.error(`Error in worker: ${error}`);
|
console.error(`Error in worker: ${error}`);
|
||||||
});
|
});
|
||||||
workerProcess.on('exit', (code) => {
|
workerProcess.on('exit', (code) => {
|
||||||
console.log(`Worker exited with code: ${code}`);
|
console.log(`Worker exited with code: ${code}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/', function (req, res) {
|
app.get('/', function (req, res) {
|
||||||
return res.send('Maxun server started 🚀');
|
return res.send('Maxun server started 🚀');
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/csrf-token', (req, res) => {
|
|
||||||
res.json({ csrfToken: req.csrfToken() })
|
|
||||||
})
|
|
||||||
|
|
||||||
server.listen(SERVER_PORT, async () => {
|
server.listen(SERVER_PORT, async () => {
|
||||||
await connectDB();
|
await connectDB();
|
||||||
await syncDB();
|
await syncDB();
|
||||||
|
|||||||
Reference in New Issue
Block a user