Skip to content

Instantly share code, notes, and snippets.

@harrietty
Last active December 22, 2017 12:39
Show Gist options
  • Select an option

  • Save harrietty/9ad313e43c2389ee1f96113b04b3d2bb to your computer and use it in GitHub Desktop.

Select an option

Save harrietty/9ad313e43c2389ee1f96113b04b3d2bb to your computer and use it in GitHub Desktop.
function Hexpress () {
this.routeMappings = {};
};
Hexpress.prototype.get = function (route, handler) {
this.routeMappings[`GET ${route}`] = handler;
};
// Usage:
const app = new Hexpress();
app.get('/api/hexes', (req, res) => res.send('Loads of hexes'));
app.get('/api/cauldrons', (req, res) => res.send('Loads of cauldrons'));
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment