File tree Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Original file line number Diff line number Diff line change 33const express = require ( "express" ) ;
44const { Receiver } = require ( "cloudevents" ) ;
55const app = express ( ) ;
6-
7- app . use ( ( req , res , next ) => {
8- let data = "" ;
9-
10- req . setEncoding ( "utf8" ) ;
11- req . on ( "data" , function ( chunk ) {
12- data += chunk ;
13- } ) ;
14-
15- req . on ( "end" , function ( ) {
16- req . body = data ;
17- next ( ) ;
18- } ) ;
19- } ) ;
6+ const bodyParser = require ( 'body-parser' )
7+ app . use ( bodyParser . json ( ) )
208
219app . post ( "/" , ( req , res ) => {
2210 console . log ( "HEADERS" , req . headers ) ;
Original file line number Diff line number Diff line change 1414 "author" : " fabiojose@gmail.com" ,
1515 "license" : " Apache-2.0" ,
1616 "dependencies" : {
17+ "body-parser" : " ^1.19.0" ,
1718 "cloudevents" : " ^3.1.0" ,
1819 "express" : " ^4.17.1"
1920 }
You can’t perform that action at this time.
0 commit comments