Skip to content

Instantly share code, notes, and snippets.

@chrisseaton
Created April 24, 2018 22:20
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 chrisseaton/8e4fb0aa1503c2d441b7251f18e119c8 to your computer and use it in GitHub Desktop.
Save chrisseaton/8e4fb0aa1503c2d441b7251f18e119c8 to your computer and use it in GitHub Desktop.
var express = require('express');
var app = express();
color_rgb = Polyglot.eval('ruby', `
require 'color'
Color::RGB
`);
app.get('/css/:name', function (req, res) {
color = color_rgb.by_name(req.params.name).html()
res.send('<h1 style="color: ' + color + '" >' + color + '</h1>');
});
app.listen(8080, function () {
console.log('serving at http://localhost:8080')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment