diff --git a/body-parser/body-parser-tests.ts b/body-parser/body-parser-tests.ts new file mode 100644 index 0000000000..ffac86e592 --- /dev/null +++ b/body-parser/body-parser-tests.ts @@ -0,0 +1,22 @@ +import * as express from 'express'; +import { + json, + raw, + text, + urlencoded, +} from 'body-parser'; + +const app = express(); + +express.use(json()); +express.use(raw()); +express.use(text()); +express.use(urlencoded()); + +// send any data, it should be parsed and printed +express.all('/', (req, res, next) => { + console.log(req.body); + res.json(req.body); +}); + +express.listen(8080); diff --git a/body-parser/tsconfig.json b/body-parser/tsconfig.json index fe0b5d1b8a..e798cd97d3 100644 --- a/body-parser/tsconfig.json +++ b/body-parser/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, @@ -16,6 +17,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "body-parser-tests.ts" ] }