Skip to content

Instantly share code, notes, and snippets.

@BrightnBubbly

BrightnBubbly/index.js Secret

Created Apr 25, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.