diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-22 17:21:43 +0800 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-22 17:38:45 +0800 |
commit | 0d1b7e92ada02c5149abefdbc8e70d02241951ca (patch) | |
tree | efba968c647bb7185fdae711fac26c1306248f02 /examples/scalajs-react-example/server/app.js | |
parent | 63d77017a205a394e604ec9f943d0ef6d2511ef4 (diff) | |
download | cbt-0d1b7e92ada02c5149abefdbc8e70d02241951ca.tar.gz cbt-0d1b7e92ada02c5149abefdbc8e70d02241951ca.tar.bz2 cbt-0d1b7e92ada02c5149abefdbc8e70d02241951ca.zip |
Add small and simple scala js example
Diffstat (limited to 'examples/scalajs-react-example/server/app.js')
-rw-r--r-- | examples/scalajs-react-example/server/app.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/scalajs-react-example/server/app.js b/examples/scalajs-react-example/server/app.js index 620c26a..d44adcc 100644 --- a/examples/scalajs-react-example/server/app.js +++ b/examples/scalajs-react-example/server/app.js @@ -9,20 +9,20 @@ app.get('/data', function(req, res){ //'https://api.instagram.com/v1/media/popular?client_id=642176ece1e7445e99244cec26f4de1f&callback=?', 'https://pixabay.com/api/?key=2741116-9706ac6d4a58f2b5416225505&q=yellow+flowers&image_type=photo', function(response) { - - var body = ""; - response.on('data', function(data) { - body += data; - }); - response.on('end', function() { - console.log(body); - try { - res.send(JSON.parse(body)); - } catch (e) { - return console.error(e); - } - }); - }); + var body = ""; + response.on('data', function(data) { + body += data; + }); + response.on('end', function() { + console.log(body); + try { + res.send(JSON.parse(body)); + } catch (e) { + return console.error(e); + } + }); + } + ); request.on('error', function(e) { console.log('Problem with request: ' + e.message); }); |