Skip to content

Commit f27ec48

Browse files
committed
Setup Express API
1 parent 9d746e8 commit f27ec48

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/app.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ var app = express();
66

77
app.use('/', express.static('public'));
88

9+
var router = express.Router();
10+
11+
router.get('/todos', function(req, res) {
12+
res.json({ todos: [] });
13+
});
14+
15+
// TODO: Add POST route to create new entries
16+
17+
// TODO: Add PUT route to update existing entries
18+
19+
// TODO: Add DELETE route to remove existing entries
20+
21+
app.use('/api', router);
22+
923
app.listen(3000, function() {
1024
console.log("The server is running on port 3000!");
1125
});

0 commit comments

Comments
 (0)