Skip to content

Commit ae3db32

Browse files
authored
Merge pull request #9 from wercker/sorted-cities-array
Sorted cities array
2 parents b3ba8e6 + e3b5757 commit ae3db32

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ node app.js
2222

2323
Now point your browser at `http://localhost:8080` to see:
2424
```
25-
{"cities":["San Francisco","Amsterdam","Berlin","New York","Tokyo"]}
25+
{"cities":["Amsterdam","Berlin","New York","San Francisco","Tokyo"]}
2626
```
2727

2828
The second, and more useful, way is to use the `wercker dev` command to launch the binary within a Docker container, using the base image defined in the `box/id` property at the top of the `wercker.yml`, like so:
2929
```
3030
wercker dev --expose-ports
3131
```
32-
The `dev` target inside `wercker.yml` uses the `internal/watch` step to dynamically reload the runtime container when sourcefile changes are detected, which allows you to quickly test changes without having to kill/rebuild/relaunch the container. For instance, add another city to the array on `app.js:6' like so:
32+
The `dev` target inside `wercker.yml` uses the `internal/watch` step to dynamically reload the runtime container when sourcefile changes are detected, which allows you to quickly test changes without having to kill/rebuild/relaunch the container. For instance, add another city to the array on `app.js:3' like so:
3333

3434
```
35-
res.write(JSON.stringify({"cities" : ["San Francisco", "Amsterdam", "Berlin", "New York", "Tokyo", "London"]}));
35+
var cities = {"cities":["Amsterdam","Berlin","New York","San Francisco","Tokyo","London"]}
3636
```
3737

3838
and then refresh your browser pointing to `http://localhost:8080` to see:
3939
```
40-
{"cities":["San Francisco","Amsterdam","Berlin","New York","Tokyo","London"]}}
40+
{"cities":["Amsterdam","Berlin","New York","San Francisco","Tokyo","London"]}}
4141
```
4242

4343
---

app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
var express = require('express');
22
var app = express();
3+
var cities = {cities:["Amsterdam","Berlin","New York","San Francisco","Tokyo"]}
34

45
app.get('/', function(req, res){
56
res.writeHead(200, { 'Content-Type': 'application/json' });
6-
res.write(JSON.stringify({cities : ["San Francisco", "Amsterdam", "Berlin", "New York", "Tokyo"]}));
7+
res.write(JSON.stringify(cities));
78
res.end();
89
});
910

0 commit comments

Comments
 (0)