edge.libx.js 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,9 +15,10 @@ function getExpress() {
|
|
|
15
15
|
req.rawBody = buf.toString(encoding || 'utf8');
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
app.use(body_parser_1.default.
|
|
20
|
-
app.use(body_parser_1.default.
|
|
18
|
+
const payloadLimit = '25mb';
|
|
19
|
+
app.use(body_parser_1.default.json({ verify: rawBodySaver, limit: payloadLimit }));
|
|
20
|
+
app.use(body_parser_1.default.urlencoded({ verify: rawBodySaver, extended: true, limit: payloadLimit }));
|
|
21
|
+
app.use(body_parser_1.default.raw({ verify: rawBodySaver, type: '*/*', limit: payloadLimit }));
|
|
21
22
|
app.use((0, cors_1.default)());
|
|
22
23
|
const router = express_1.default.Router();
|
|
23
24
|
return { app, router };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getExpress.js","sourceRoot":"","sources":["../../src/helpers/getExpress.ts"],"names":[],"mappings":";;;;;AAIA,
|
|
1
|
+
{"version":3,"file":"getExpress.js","sourceRoot":"","sources":["../../src/helpers/getExpress.ts"],"names":[],"mappings":";;;;;AAIA,gCAuBC;AA3BD,8DAAqC;AACrC,sDAA8D;AAC9D,gDAAwB;AAExB,SAAgB,UAAU;IACtB,IAAI,GAAG,GAAY,IAAA,iBAAO,GAAE,CAAC;IAE7B,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IAE1B,IAAI,YAAY,GAAG,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ;QAChD,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACpB,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC;QACnD,CAAC;IACL,CAAC,CAAC;IAGF,MAAM,YAAY,GAAG,MAAM,CAAC;IAE5B,GAAG,CAAC,GAAG,CAAC,qBAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IACxE,GAAG,CAAC,GAAG,CAAC,qBAAU,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IAC9F,GAAG,CAAC,GAAG,CAAC,qBAAU,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IAEpF,GAAG,CAAC,GAAG,CAAC,IAAA,cAAI,GAAE,CAAC,CAAC;IAEhB,MAAM,MAAM,GAAG,iBAAO,CAAC,MAAM,EAAE,CAAC;IAEhC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC","sourcesContent":["import bodyParser from 'body-parser';\nimport express, { Express, Request, Response } from \"express\";\nimport cors from 'cors';\n\nexport function getExpress() {\n let app: Express = express();\n\n app.set('json spaces', 4);\n\n var rawBodySaver = function (req, res, buf, encoding) {\n if (buf && buf.length) {\n req.rawBody = buf.toString(encoding || 'utf8');\n }\n };\n\n // Increase payload limits for audio uploads (STT) - up to 25MB to match OpenAI's limit\n const payloadLimit = '25mb';\n\n app.use(bodyParser.json({ verify: rawBodySaver, limit: payloadLimit }));\n app.use(bodyParser.urlencoded({ verify: rawBodySaver, extended: true, limit: payloadLimit }));\n app.use(bodyParser.raw({ verify: rawBodySaver, type: '*/*', limit: payloadLimit }));\n\n app.use(cors());\n\n const router = express.Router();\n\n return { app, router };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -3,23 +3,26 @@ import express, { Express, Request, Response } from "express";
|
|
|
3
3
|
import cors from 'cors';
|
|
4
4
|
|
|
5
5
|
export function getExpress() {
|
|
6
|
-
|
|
6
|
+
let app: Express = express();
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
app.set('json spaces', 4);
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
var rawBodySaver = function (req, res, buf, encoding) {
|
|
11
|
+
if (buf && buf.length) {
|
|
12
|
+
req.rawBody = buf.toString(encoding || 'utf8');
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
app.use(bodyParser.raw({ verify: rawBodySaver, type: '*/*' }));
|
|
16
|
+
// Increase payload limits for audio uploads (STT) - up to 25MB to match OpenAI's limit
|
|
17
|
+
const payloadLimit = '25mb';
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
app.use(bodyParser.json({ verify: rawBodySaver, limit: payloadLimit }));
|
|
20
|
+
app.use(bodyParser.urlencoded({ verify: rawBodySaver, extended: true, limit: payloadLimit }));
|
|
21
|
+
app.use(bodyParser.raw({ verify: rawBodySaver, type: '*/*', limit: payloadLimit }));
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
app.use(cors());
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
const router = express.Router();
|
|
26
|
+
|
|
27
|
+
return { app, router };
|
|
25
28
|
}
|