Created
November 14, 2018 00:06
-
-
Save nebrelbug/d7c97a7bcf15833a4637bb6e3c6c906b to your computer and use it in GitHub Desktop.
Basic server with Squirrelly and Express
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
let express = require('express'); | |
let path = require('path'); | |
let app = express(); | |
var Sqrl = require('squirrelly') | |
let server = app.listen(8080, function () { | |
console.log("listening to requests on port 8080"); | |
}); | |
app.get('/:left/:right/:color', function (req, res) { | |
var badge = Sqrl.renderFile(path.join(__dirname, 'template.svg'), req.params) | |
res.writeHead(200, { | |
"Content-Type": "image/svg+xml" | |
}) | |
res.write(badge); | |
res.end(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment