We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 24fe8c4 commit 1d3312dCopy full SHA for 1d3312d
course-02/exercises/udacity-c2-basic-server/src/server.ts
@@ -1,5 +1,6 @@
1
import express, { Router, Request, Response } from 'express';
2
-import bodyParser from 'body-parser';
+// import bodyParser from 'body-parser'; deprecated
3
+const bodyParser = require('body-parser')
4
5
import { Car, cars as cars_list } from './cars';
6
@@ -14,6 +15,7 @@ import { Car, cars as cars_list } from './cars';
14
15
//use middleware so post bodies
16
//are accessable as req.body.{{variable}}
17
app.use(bodyParser.json());
18
+ app.use(express.urlencoded({ extended: true })) //for requests from forms-like data
19
20
// Root URI call
21
app.get( "/", ( req: Request, res: Response ) => {
0 commit comments