Skip to content

Commit b2cb159

Browse files
committed
Add an example of Node.js app.
1 parent faf4d82 commit b2cb159

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

node/app1/app.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var express = require("express");
2+
var app = express();
3+
4+
app.get("/", function(req, res, next){
5+
res.json({"name": "dog"});
6+
});
7+
8+
var server = app.listen(process.env.PORT || 3000, function(){
9+
console.log("Node.js is listening to PORT:" + server.address().port);
10+
});
11+

node/app1/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "app1",
3+
"version": "1.0.0",
4+
"description": "Application 1",
5+
"main": "app.js",
6+
"scripts": {
7+
"start": "node app.js"
8+
},
9+
"author": "Kazuhiro Yamato",
10+
"license": "MIT",
11+
"dependencies": {
12+
"express": "^4.15"
13+
}
14+
}

0 commit comments

Comments
 (0)