1.2.0 (2024-08-10)
- The location of the typed parameter has been changed. The parameter is now specified for a specific parser rather than for a parser factory:
Now:
import { getJsonParser } from '@ts-stack/body-parser';
import { InterfaceOfBody } from './types';
const jsonParser = getJsonParser();
const body = await jsonParser<InterfaceOfBody>();Before:
import { getJsonParser } from '@ts-stack/body-parser';
import { InterfaceOfBody } from './types';
const jsonParser = getJsonParser<InterfaceOfBody>();
const body = await jsonParser();1.1.1 (2024-07-28)
1.1.0 (2024-07-21)
- Added
BodyParserGrouphelper. It intended for cases when you do not know which parser should work for a particular route. To initialize it, you can first pass parser options to its constructor, and then you can use theparsemethod:
import { BodyParserGroup } from '@ts-stack/body-parser';
const bodyParserGroup = new BodyParserGroup({
jsonOptions: config.jsonOptions,
textOptions: config.textOptions,
urlencodedOptions: config.urlencodedOptions,
rawOptions: config.rawOptions,
});
const body = await bodyParserGroup.parse(req, req.headers, {});