Last active
April 15, 2020 10:22
-
-
Save KingIdee/415e9fff09e8b67737883ca704f8e994 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
// index.js | |
const express = require('express'); | |
const StreamChat = require('stream-chat').StreamChat; | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
const client = new StreamChat('API_KEY', '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