Skip to content

Instantly share code, notes, and snippets.

@Kennypee Kennypee/server.js
Created Jul 6, 2018

What would you like to do?
const Pusher = require('pusher');
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const app = express();
app.use(bodyParser.urlencoded({extended: false}));
var pusher = new Pusher({
appId: 'use-your-own-Id',
key: 'use-your-own-key',
secret: 'use-your-own-secret',
cluster: 'eu',
encrypted: true
app.set('PORT', process.env.PORT || 6000);'/message', (req, res) => {
const message = req.body;
pusher.trigger('chat', 'message', message);
app.listen(app.get('PORT'), () =>
console.log('Listening at ' + app.get('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.