-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
45 lines (32 loc) · 992 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require('dotenv').load();
var express = require('express'),
bodyParser = require('body-parser'),
app = express(),
port = process.env.PORT || 3000;
var KeenTracking = require('keen-tracking');
// This is your actual Project ID and Write Key
var client = new KeenTracking({
projectId: process.env.KEEN_PROJECT_ID,
writeKey: process.env.KEEN_WRITE_KEY
});
// Record an event
// client.recordEvent('pageviews', {
// title: document.title
// });
app.use(bodyParser.json());
app.post('/', function (req, res) {
var body = req.body;
console.log('Body: ', body)
// var trackingNumber = body.msg.tracking_number;
// var slug = body.msg.slug;
// var token = body.msg.unique_token;
// console.log(trackingNumber, slug, token);
res.json({
message: 'ok got it!'
});
});
var server = app.listen(port, function () {
var host = server.address().address
var port = server.address().port
console.log('Example app listening at http://%s:%s', host, port)
});