Skip to content

Commit 05c1a02

Browse files
author
Micha Hernandez van Leuffen
committed
init
0 parents  commit 05c1a02

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Node.js sample application for wercker built with Express

app.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var express = require('express');
2+
var app = express();
3+
4+
app.get('/cities.json', function(req, res){
5+
res.writeHead(200, { 'Content-Type': 'application/json' });
6+
res.write(JSON.stringify({insecticons : ["San Francisco","Amsterdam", "Berlin", "New York"]}));
7+
res.end();
8+
});
9+
10+
var port = process.env.PORT || 5000;
11+
app.listen(port);
12+
13+
module.exports = app;

package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "getting-started-nodejs",
3+
"version": "0.0.1",
4+
"engines" : {
5+
"node": "0.6.x"
6+
},
7+
"dependencies": {
8+
"express": "3.x",
9+
"nodeunit": "0.7.4",
10+
"supertest" : "0.4.0",
11+
"mocha" : "1.6.0"
12+
},
13+
"scripts": {
14+
"test": "mocha",
15+
"start": "app.js"
16+
}
17+
}

test/test.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var request = require('supertest')
2+
, express = require('express');
3+
4+
var app = require('../app.js');
5+
6+
describe('GET', function(){
7+
it('respond with json', function(done){
8+
request(app)
9+
.get('/cities.json')
10+
.set('Accept', 'application/json')
11+
.expect('Content-Type', /json/)
12+
.expect(200, done);
13+
})
14+
})

0 commit comments

Comments
 (0)