Skip to content

Instantly share code, notes, and snippets.

@nebrelbug
Created November 14, 2018 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nebrelbug/d7c97a7bcf15833a4637bb6e3c6c906b to your computer and use it in GitHub Desktop.
Save nebrelbug/d7c97a7bcf15833a4637bb6e3c6c906b to your computer and use it in GitHub Desktop.
Basic server with Squirrelly and Express
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