fix: update express example with framework features. (#429)
fixes #379 Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
This commit is contained in:
parent
1ceed024f8
commit
272bcea2d8
|
@ -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));
|
||||||
|
|
Loading…
Reference in New Issue