Skip to content

Commit aa729bb

Browse files
committed
move initial comments to json file
1 parent 4c1071d commit aa729bb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

_comments.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"author": "Pete Hunt",
4+
"text": "Hey there!"
5+
}
6+
]

server.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
var fs = require('fs');
12
var express = require('express');
23
var bodyParser = require('body-parser');
34
var app = express();
45

5-
var comments = [{author: 'Pete Hunt', text: 'Hey there!'}];
6+
var comments = JSON.parse(fs.readFileSync('_comments.json'))
67

78
app.use('/', express.static(__dirname));
89
app.use(bodyParser.json());

0 commit comments

Comments
 (0)