repl.it
@Kognise/

SCS API Spammer

Nodejs

No description

fork
loading
Files
  • index.js
  • package-lock.json
  • package.json
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
// const fetch = require('node-fetch')
// const fs = require('fs')

// const fetchTopicMessages = (topic) => {
//   const end = new Date() // End date is current date
//   const start = new Date(end) // Copy end date to start date
//   start.setHours(start.getHours() - 1) // Turn start date back an hour

//   console.log(`https://aws.southcoastscience.com/topicMessages?topic=${
//     encodeURIComponent(topic)
//   }&startTime=${
//     encodeURIComponent(start.toISOString())
//   }&endTime=${
//     encodeURIComponent(end.toISOString())
//   }`)
//   return fetch(`https://aws.southcoastscience.com/topicMessages?topic=${
//     encodeURIComponent(topic)
//   }&startTime=${
//     encodeURIComponent(start.toISOString())
//   }&endTime=${
//     encodeURIComponent(end.toISOString())
//   }`).then((res) => res.json())
// }

// let counter = 0
// let errored = false
// setInterval(() => {
//   fetchTopicMessages('nyu/brooklyn/loc/1/climate').then((json) => {
//     console.log(`Spammed ${++counter} times`)
//   }).catch(() => {
//     counter = 0
//   })
// }, 1000)

// require('express')().get('/', (req, res) => res.send(`Spammed ${counter} times`)).listen()
node v10.16.0