fix: update express example with framework features. (#429)

fixes #379

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
This commit is contained in:
Lucas Holmquist 2021-08-30 16:46:12 -04:00 committed by GitHub
parent 1ceed024f8
commit 272bcea2d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -33,7 +33,12 @@ app.post("/", (req, res) => {
responseEventMessage.data = { responseEventMessage.data = {
hello: 'world' hello: 'world'
}; };
res.status(201).json(responseEventMessage);
// const message = HTTP.binary(responseEventMessage)
const message = HTTP.structured(responseEventMessage)
res.set(message.headers)
res.send(message.body)
} catch (err) { } catch (err) {
console.error(err); console.error(err);
res.status(415).header("Content-Type", "application/json").send(JSON.stringify(err)); res.status(415).header("Content-Type", "application/json").send(JSON.stringify(err));