Skip to content

Commit

Permalink
fix: JSON body parser required for demo code to work (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
liangyuanruo committed Jun 16, 2020
1 parent e21fb8c commit 5208966
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const formsg = require('@opengovsg/formsg-sdk')({

```javascript
// This example uses Express to receive webhooks
const app = require('express')()
const express = require('express')
const app = express()

// Instantiating formsg-sdk without parameters default to using the package's
// production public signing key.
Expand All @@ -58,9 +59,11 @@ app.post(
return res.status(401).send({ message: 'Unauthorized' })
}
},
// Parse JSON from raw request body
express.json(),
// Decrypt the submission
function (req, res, next) {
// `req.body.data` must be an object fulfilling the DecryptParams interface.
// `req.body.data` is an object fulfilling the DecryptParams interface.
// interface DecryptParams {
// encryptedContent: EncryptedContent
// version: number
Expand Down

0 comments on commit 5208966

Please sign in to comment.