Implement v2 API for stateful sessions and add engagement metrics support
This commit is contained in:
9
api.js
9
api.js
@@ -1,4 +1,5 @@
|
||||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
@@ -18,6 +19,14 @@ if (!fs.existsSync(CACHE_DIR)) {
|
||||
app.use(express.json({ limit: '1gb' }));
|
||||
app.use(express.urlencoded({ limit: '1gb', extended: true }));
|
||||
|
||||
// enable CORS for all routes
|
||||
app.use(cors({
|
||||
origin: '*',
|
||||
methods: ['GET', 'POST', 'PATCH', 'DELETE', 'OPTIONS'],
|
||||
allowedHeaders: ['Content-Type', 'Authorization'],
|
||||
credentials: false
|
||||
}));
|
||||
|
||||
// Request logging middleware
|
||||
app.use((req, res, next) => {
|
||||
// skip logging health checks
|
||||
|
||||
Reference in New Issue
Block a user