-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (21 loc) · 782 Bytes
/
index.js
File metadata and controls
34 lines (21 loc) · 782 Bytes
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
const express = require('express')
const Queue = require('./helpers/queue')
const app = express()
app.use(express.json())
let q = new Queue();
app.post('/webhook', (req, res) => {
const { admin_graphql_api_id, status } = req.body
const webhook_id = req.header('x-shopify-webhook-id')
res.sendStatus(200)
console.log('\n========== ⚡ Received Webhook Response ⚡ ==========')
console.log(`\nWebhook ID Header => ${webhook_id}`)
console.log(`Bulk Operation ID => ${admin_graphql_api_id}`)
console.log(`Status => ${status}`)
q.enqueue(webhook_id);
console.log('\n========== ⚡ Queue Items ⚡ ==========\n')
q.print();
console.log(q.getLength());
})
app.listen(8080, () => {
console.log('🚀 listening on port 8080')
})