Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var pusher = require("pusher")
var express = require("express")
var Pusher = require("pusher")
var bodyParser = require("body-parser")
var Webtask = require("webtask-tools")
var pusher = new Pusher({
appId: "app_id",
key: "pusher_id",
secret: "pusher_secret",
cluster: "app_cluster"
});
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.post('/location', (req, res,next)=>{
var longitude = req.body.longitude;
var latitude = req.body.latitude;
var username = req.body.username;
console.log({longitude, latitude,username});
pusher.trigger('feed', 'location', {longitude, latitude,username});
res.json({success: 200});
});
module.exports = Webtask.fromExpress(app);
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.