Skip to content

Commit 4fcca2e

Browse files
authored
Merge pull request udacity#506 from AnitaMatt/stage
Replace deprecated body parser import
2 parents 0b2ee1e + e8cb57a commit 4fcca2e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# cloud-developer
22
content for Udacity's cloud developer nanodegree.
3+

course-02/exercises/udacity-c2-basic-server/src/server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import express, { Router, Request, Response } from 'express';
2-
import bodyParser from 'body-parser';
2+
// import bodyParser from 'body-parser'; deprecated
3+
const bodyParser = require('body-parser')
34

45
import { Car, cars as cars_list } from './cars';
56

@@ -14,6 +15,7 @@ import { Car, cars as cars_list } from './cars';
1415
//use middleware so post bodies
1516
//are accessable as req.body.{{variable}}
1617
app.use(bodyParser.json());
18+
app.use(express.urlencoded({ extended: true })) //for requests from forms-like data
1719

1820
// Root URI call
1921
app.get( "/", ( req: Request, res: Response ) => {

0 commit comments

Comments
 (0)