Compare commits

...

10 Commits

Author SHA1 Message Date
14bfa3f62f 3.0.26 2024-03-01 00:14:34 +01:00
9e4413c276 fix(core): update 2024-03-01 00:14:34 +01:00
dd91691064 3.0.25 2024-02-29 18:58:10 +01:00
bf4794c06f fix(core): update 2024-02-29 18:58:09 +01:00
7e04474a66 3.0.24 2024-02-24 18:33:33 +01:00
907d51a842 fix(core): update 2024-02-24 18:33:33 +01:00
2114ff28c0 3.0.23 2024-02-21 01:16:39 +01:00
fd9431f82b fix(core): update 2024-02-21 01:16:39 +01:00
e8c1a66e15 3.0.22 2024-02-21 01:06:53 +01:00
1e98fd99f4 fix(core): update 2024-02-21 01:06:52 +01:00
7 changed files with 405 additions and 389 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@api.global/typedserver",
"version": "3.0.21",
"version": "3.0.26",
"description": "easy serving of static files",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
@ -37,16 +37,16 @@
],
"homepage": "https://github.com/pushrocks/easyserve",
"dependencies": {
"@api.global/typedrequest": "^3.0.4",
"@api.global/typedrequest-interfaces": "^3.0.1",
"@api.global/typedrequest": "^3.0.17",
"@api.global/typedrequest-interfaces": "^3.0.18",
"@api.global/typedsocket": "^3.0.0",
"@push.rocks/lik": "^6.0.12",
"@push.rocks/smartchok": "^1.0.23",
"@push.rocks/lik": "^6.0.14",
"@push.rocks/smartchok": "^1.0.33",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartenv": "^5.0.12",
"@push.rocks/smartfeed": "^1.0.11",
"@push.rocks/smartfile": "^11.0.4",
"@push.rocks/smartjson": "^5.0.10",
"@push.rocks/smartjson": "^5.0.11",
"@push.rocks/smartlog": "^3.0.3",
"@push.rocks/smartlog-destination-devtools": "^1.0.10",
"@push.rocks/smartmanifest": "^2.0.2",
@ -57,24 +57,24 @@
"@push.rocks/smartrequest": "^2.0.21",
"@push.rocks/smartrx": "^3.0.7",
"@push.rocks/smartsitemap": "^2.0.3",
"@push.rocks/smartstream": "^3.0.30",
"@push.rocks/smartstream": "^3.0.33",
"@push.rocks/smarttime": "^4.0.6",
"@push.rocks/webstore": "^2.0.13",
"@tsclass/tsclass": "^4.0.46",
"@tsclass/tsclass": "^4.0.52",
"@types/express": "^4.17.21",
"body-parser": "^1.20.2",
"cors": "^2.8.5",
"express": "^4.18.2",
"express": "^4.18.3",
"express-force-ssl": "^0.3.2",
"lit": "^3.1.0"
"lit": "^3.1.2"
},
"devDependencies": {
"@git.zone/tsbuild": "^2.1.66",
"@git.zone/tsbundle": "^2.0.8",
"@git.zone/tsbuild": "^2.1.72",
"@git.zone/tsbundle": "^2.0.15",
"@git.zone/tsrun": "^1.2.44",
"@git.zone/tstest": "^1.0.84",
"@git.zone/tstest": "^1.0.86",
"@push.rocks/tapbundle": "^5.0.15",
"@types/node": "^20.10.7"
"@types/node": "^20.11.24"
},
"private": false,
"browserslist": [

737
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedserver',
version: '3.0.21',
version: '3.0.26',
description: 'easy serving of static files'
}

View File

@ -11,7 +11,9 @@ export class HandlerTypedRouter extends Handler {
constructor(typedrouter: plugins.typedrequest.TypedRouter) {
super('POST', async (req, res) => {
const response = await typedrouter.routeAndAddResponse(req.body);
res.json(plugins.smartjson.stringify(response));
res.type('json');
res.write(plugins.smartjson.stringify(response));
res.end();
});
}
}

View File

@ -142,7 +142,24 @@ export class Server {
});
// body parsing
this.expressAppInstance.use(plugins.bodyParser.json({ limit: 100000000 })); // for parsing application/json
this.expressAppInstance.use(async (req, res, next) => {
if (req.headers['content-type'] === 'application/json') {
let data = '';
req.on('data', chunk => {
data += chunk;
});
req.on('end', () => {
try {
req.body = plugins.smartjson.parse(data);
next();
} catch (error) {
res.status(400).send('Invalid JSON');
}
});
} else {
next();
}
});
this.expressAppInstance.use(plugins.bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
// robots

View File

@ -178,7 +178,7 @@ export class TypedServer {
);
}
if (this.options.watch && this.options.serveDir) {
this.smartchokInstance = new plugins.smartchok.Smartchok([this.options.serveDir], {});
this.smartchokInstance = new plugins.smartchok.Smartchok([this.options.serveDir]);
await this.smartchokInstance.start();
(await this.smartchokInstance.getObservableFor('change')).subscribe(async () => {
await this.createServeDirHash();

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedserver',
version: '3.0.21',
version: '3.0.26',
description: 'easy serving of static files'
}