Skip to content

Commit ecaa493

Browse files
committed
Merge branch 'development'
2 parents c27c33d + 7822cd0 commit ecaa493

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

express/appsendjson.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env node
2+
const express = require("express");
3+
const _ = require("lodash");
4+
5+
const app = express();
6+
7+
app.get("/movies", (req, res) => {
8+
res.set({ "Content-Type": "application/json; charset=utf-8" });
9+
let movies = { 1: "Toy story", 2: "The Raid", 3: "Hero",
10+
4: "Ip Man", 5: "Kung Fu Panda" };
11+
let movie = _.sample(movies);
12+
res.json({movie});
13+
});
14+
15+
app.listen(3000, () => console.log("Application started on port 3000"));

0 commit comments

Comments
 (0)