Skip to content

Instantly share code, notes, and snippets.

@BrightnBubbly
Created April 25, 2020 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrightnBubbly/a527a1702957b1fd6b5336b070067087 to your computer and use it in GitHub Desktop.
Save BrightnBubbly/a527a1702957b1fd6b5336b070067087 to your computer and use it in GitHub Desktop.
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