Last active
September 7, 2016 15:09
-
-
Save JamesAwesome/6faa5f8d54a5f9041d736043447f68e3 to your computer and use it in GitHub Desktop.
PooPI
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
node_modules |
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
#!/usr/bin/env node | |
'use strict'; | |
var express = require('express'); | |
var app = express(); | |
app.get('/', function (req, res) { | |
var amount_of_shit = req.query.count || '1'; | |
if (amount_of_shit.match(/\D/)) { | |
res.status(400).send('ERROR: Value of `count` must be a number!'); | |
return; | |
}; | |
if (parseInt(amount_of_shit, 10) > 9000) { | |
res.status(413).send('ERROR: Too much shit!'); | |
return; | |
}; | |
res.send('💩'.repeat(amount_of_shit)); | |
}); | |
app.listen(3000) |
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
FROM node:6.5.0-wheezy | |
RUN mkdir -p /srv/poopi | |
COPY ./ /srv/poopi/ | |
WORKDIR /srv/poopi | |
RUN npm install | |
CMD ./app.js |
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
{ | |
"dependencies": { | |
"express": "^4.14.0" | |
} | |
} |
Author
JamesAwesome
commented
Sep 7, 2016
Docker Usage
docker pull jamesawesome/poopi
docker run -p 3000:3000 -d jamesawesome/poopi
curl -sLo - "http://localhost:3000/?count=300"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment