Skip to content

Instantly share code, notes, and snippets.

@mathiasose
Last active May 4, 2018 11:17
Show Gist options
  • Save mathiasose/eda016d82deceba3bb30ccca229d605f to your computer and use it in GitHub Desktop.
Save mathiasose/eda016d82deceba3bb30ccca229d605f to your computer and use it in GitHub Desktop.
const { send, json } = require('micro');
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
async function throwDice(req, res) {
const n = getRandomInt(6) + 1;
return {
reply: n
};
}
module.exports = throwDice;
{
"name": "kindly-roll-dice",
"scripts": {
"start": "micro",
"dev": "micro-dev"
},
"dependencies": {
"micro": "latest"
},
"devDependencies": {
"micro-dev": "latest"
}
}
npm install -g now
npm install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment