Last active
January 4, 2019 07:48
-
-
Save RichFromGalvanize/5873044 to your computer and use it in GitHub Desktop.
An image piping example using Node.js, express, and request...BOOYA!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var express = require('express'); | |
var app = express(); | |
app.get('/goofy', function(req, res) { | |
request('http://images1.wikia.nocookie.net/__cb20120715102950/disney/images/a/a5/Disneygoofy2012.jpeg').pipe(res); | |
}); | |
app.get('/loop', function(req, res) { | |
res.render('mypage'); | |
}); | |
app.listen(9999); |
👍
Great! thanks!!! :D
Looks nice ; Hey what if I want to write the image to disk (to cache it) and send back its filepath instead?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!