Skip to content

Instantly share code, notes, and snippets.

@ms-vague
Last active June 11, 2017 17:53
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 ms-vague/97f240fb5b16095c00c6f11f7970e5f9 to your computer and use it in GitHub Desktop.
Save ms-vague/97f240fb5b16095c00c6f11f7970e5f9 to your computer and use it in GitHub Desktop.
reqresdrills
// Echo endpoint //
https://glitch.com/edit/#!/rune-cut?path=server.js:13:36
// This what I had before my thirty minutes were up:
const express = require('express');
const app = express();
// your code here!
app.get('/echo/:what', (req, res) => res.json({'host': , 'query':, 'params':, });
// I screwed up some of the syntax before res.json. Also was trying to hardcode an actual object for the res.json. //
app.listen(process.env.PORT, () => {
console.log(`Listening on port ${process.env.PORT}`);
});
// Mad lib generator //
https://glitch.com/edit/#!/green-voyage?path=server.js:10:0
// Yeah I was pretty off with this one
const express = require('express');
const app = express();
// your code here.
const logMadLibs = (parameters) => {
const = {adjective1, name, name, adjective2, adverb, adjective3, name, name, noun};
}
app.get('/', (req, res) => {
res.send(`There's a ${adjective1} new ${name} in ${name} and everyone'\s talking. Stunningly ${adjective2} and ${adverb} {$adjective3}, all the cool kids know it.
However, ${name} has a secret - ${name}'\s a vile vampire.
Will it end with a bite, or with a stake through the ${noun}?`);
});
// listen for requests :)
app.listen(process.env.PORT || 8080, () => console.log(
`Your app is listening on port ${process.env.PORT || 8080}`));
// A/B Test //
https://glitch.com/edit/#!/light-sage?path=server.js:14:58
I was way off on this one so I'm just going to share the link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment