This commit is contained in:
David
2019-06-14 12:26:08 -07:00
commit 7f2f4661c7
5 changed files with 2047 additions and 0 deletions

32
README.md Normal file
View File

@@ -0,0 +1,32 @@
![Outlier.org](https://i.imgur.com/vJowpL1.png)
---
# Outlier Engineering Git Challenge
At Outlier, you will be expected to be able to contribute features and fixes without causing conflicts and other version control headaches. An important tool for keeping codebases clean is `git rebase`. This challenge will test your understanding of a basic codebase and your ability to use `git rebase` properly.
## The Challenge
There are two pull requests open on this repo. Each change is in its own branch. The challenge is to use `git rebase` to add both changes to `master`. When you are finished, your `master` branch should have three commits in the following order:
```
* feat: add base64 endpoint
* feat: add user-agent endpoint
* init
```
_ Any errors, missing features, missing tests, or failing tests will disqualify the solution. _
## Instructions
How to attempt this challenge:
1) Create a new repo in your account and note the git url
2) Clone this repo
3) Solve the challenge
4) Set your new repo as the origin: `git remote set-url origin ${your repo url}`
5) Push your solution to your repo
You must follow these steps for your solution to be accepted -- forks or other methods will not be considered.

1958
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

18
package.json Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "challenge-git",
"version": "1.0.0",
"description": "A Git Challenge",
"main": "index.js",
"scripts": {
"start": "node server.js",
"test": "node test.js"
},
"keywords": [],
"license": "MIT",
"devDependencies": {
"get-port-sync": "^1.0.0",
"jsonist": "^2.1.0",
"standard": "^12.0.1",
"tape": "^4.10.2"
}
}

18
server.js Normal file
View File

@@ -0,0 +1,18 @@
const http = require('http')
const PORT = process.env.PORT || 3000
const server = http.createServer((req, res) => {
if (req.url === '/') return respondHello(req, res)
res.end()
})
function respondHello (req, res) {
res.end(JSON.stringify({ msg: 'hello' }))
}
server.listen(PORT)
console.log(`Server listening on port ${PORT}`)
if (require.main !== module) module.exports = server

21
test.js Normal file
View File

@@ -0,0 +1,21 @@
const tape = require('tape')
const jsonist = require('jsonist')
const PORT = process.env.PORT = process.env.PORT || require('get-PORT-sync')()
const server = require('./server')
const urlBase = `http://localhost:${PORT}`
tape('should respond hello', (t) => {
jsonist.get(urlBase, (err, body) => {
if (err) t.error(err)
t.equal(body.msg, 'hello')
t.end()
})
})
tape('cleanup', function (t) {
server.close()
t.end()
})