Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const express = require('express')
const bodyParser = require('body-parser')
const app = express()
app.use(bodyParser.json({ type: 'application/*+json' }));
const port = 3000
app.get('/dapr/subscribe', (req, res) => {
res.json([
{
topic: "songs",
route: "playlist"
}
]);
})
app.post('/playlist', (req, res) => {
let song = req.body.data;
console.log("New song request: " + song.artist + " - " + song.name);
res.sendStatus(200);
});
app.listen(port, () => console.log(`consumer app listening on port ${port}!`))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.