Skip to content

Commit 24de7e8

Browse files
committedJun 6, 2017
second commit?
0 parents  commit 24de7e8

File tree

8,762 files changed

+1288584
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

8,762 files changed

+1288584
-0
lines changed
 

‎BizchoolPlatform/app.js

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
var express = require('express');
2+
var app = express();
3+
// var bodyParser = require('body-parser');
4+
5+
//express로 template를 렌더링 하기 위해 app.set() 설정
6+
app.locals.pretty = true;
7+
app.set('view engine', 'jade');
8+
app.set('views', './views');
9+
// 정적파일의 상대위치의 루트폴더 지정
10+
app.use(express.static('static'));
11+
// app.use(bodyParser.urlencoded({ extended: false }))
12+
13+
app.get('/', function(req,res){
14+
res.send('hello');
15+
// form default=post, method='get'가능,
16+
// method='post'이면 출력시에도 쿼리스트링이 붙지않음
17+
})
18+
19+
// post 방식 입력 : url= localhost:3000/home
20+
app.get('/home', function(req,res){
21+
res.render('home');
22+
// form default=post, method='get'가능,
23+
// method='post'이면 출력시에도 쿼리스트링이 붙지않음
24+
})
25+
26+
app.get('/board', function(req,res){
27+
res.render('board');
28+
// form default=post, method='get'가능,
29+
// method='post'이면 출력시에도 쿼리스트링이 붙지않음
30+
})
31+
app.get('/write', function(req,res){
32+
res.render('write');
33+
// form default=post, method='get'가능,
34+
// method='post'이면 출력시에도 쿼리스트링이 붙지않음
35+
})
36+
app.get('/inus', function(req,res){
37+
res.render('inus');
38+
// form default=post, method='get'가능,
39+
// method='post'이면 출력시에도 쿼리스트링이 붙지않음
40+
})
41+
42+
//아래는 예시
43+
app.get('/dynamic', function(req, res){
44+
var lis = '';
45+
for(var i=0; i<5; i++){
46+
lis = lis + '<li>coding</li>';
47+
}
48+
var time = Date();
49+
var output = `
50+
<!DOCTYPE html>
51+
<html>
52+
<head>
53+
<meta charset="utf-8">
54+
<title></title>
55+
</head>
56+
<body>
57+
Hello, Dynamic!
58+
<ul>
59+
${lis}
60+
</ul>
61+
${time}
62+
</body>
63+
</html>`;
64+
res.send(output);
65+
});
66+
67+
app.listen(3000, function(){
68+
console.log('Conneted 3000 port!');
69+
});

‎BizchoolPlatform/images/mindpiggy.png

38 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.