Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍용민
/
BusTime
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이의준
2021-06-05 02:28:42 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d583cfb833236307627b939f6d19ee9065c2ae64
d583cfb8
1 parent
bb3204c2
css파일 적용기능 구현
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
15 deletions
router/main.js
server.js
views/Index.html
router/main.js
View file @
d583cfb
var
url
=
require
(
'url'
);
var
request
=
require
(
'request'
);
var
qs
=
require
(
'querystring'
);
const
{
METHODS
}
=
require
(
'http'
);
module
.
exports
=
function
(
app
)
{
...
...
@@ -11,6 +13,13 @@ module.exports = function(app)
var
_url
=
req
.
url
;
var
queryData
=
url
.
parse
(
_url
,
true
).
query
;
var
busNum
=
queryData
.
busNum
;
const
options
=
{
url
:
'http://IPv4:port/__dirname'
,
method
:
'GET'
,
headers
:
{
}
};
request
.
post
(
{
...
...
@@ -22,20 +31,8 @@ module.exports = function(app)
json
:
true
}
);
res
.
end
(
'http://localhost:23023/resfromControllServer'
);
// 밑의 get활성화를 위함
});
app
.
get
(
'/resfromControllServer'
,
function
(
req
,
res
){
var
body
=
''
;
req
.
on
(
'data'
,
function
(
data
){
body
=
body
+
data
;
});
req
.
on
(
'end'
,
function
()
{
var
post
=
qs
.
parse
(
body
);
console
.
log
(
body
);
});
var
resFromServer
=
body
.
value1
;
var
resFromServer
=
JSON
.
parse
(
res
);
var
templateTimeTable
=
`
<!doctype html>
...
...
@@ -58,5 +55,6 @@ module.exports = function(app)
</html>
`
;
res
.
send
(
templateTimeTable
);
});
}
...
...
server.js
View file @
d583cfb
...
...
@@ -2,7 +2,6 @@ var express = require('express');
var
app
=
express
();
var
router
=
require
(
'./router/main'
)(
app
);
// router모듈인 main.js를 불러와서 app에 전달
//__dirname : 현재 실행중인 폴더 경로
app
.
set
(
'views'
,
__dirname
+
'/views'
);
//서버가 읽을 수 있도록 HTML 의 위치를 정의
app
.
set
(
'view engine'
,
'ejs'
);
//서버가 HTML 렌더링을 할 때, EJS 엔진을 사용하도록 설정
...
...
@@ -14,4 +13,4 @@ var server = app.listen(23023, function () {
console
.
log
(
"app listening at http://%s:%s"
,
host
,
port
)
})
app
.
use
(
express
.
static
(
'
public'
));
app
.
use
(
express
.
static
(
__dirname
+
'/
public'
));
...
...
views/Index.html
View file @
d583cfb
...
...
@@ -13,6 +13,7 @@
<body>
<h1><p
style=
"text-align:center;"
>
BTT
</p></h1>
<br>
<link
rel=
'stylesheet'
type=
'text/css'
href=
'/css/style.css'
/>
<h2>
사색의 광장 Bus Time Table 조회 서비스에 오신 것을 환영합니다.
</h2>
<p>
이곳에는 사색의 광장에서 출발하는 모든 버스의 정보가 있습니다.
</p>
<br><br>
...
...
Please
register
or
login
to post a comment