-
-
Save BrightnBubbly/a527a1702957b1fd6b5336b070067087 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const StreamChat = require('stream-chat').StreamChat; | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
const client = new StreamChat('your_API_KEY', 'your_API_SECRET'); | |
app.use(bodyParser.json()); | |
app.post('/token', (req, res, next) => { | |
const userToken = client.createToken(req.body.userId); | |
res.json({success: 200, token: userToken}); | |
}); | |
app.listen(4000, _ => console.log('App listening on port 4000!')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment