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-10 03:27:17 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f2483e381933d387ddb75a55d2381d340011b775
f2483e38
1 parent
c5956ddd
server app.js로 통합
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
43 deletions
base.js
base.js
deleted
100644 → 0
View file @
c5956dd
var
http
=
require
(
'http'
);
var
fs
=
require
(
'fs'
);
var
url
=
require
(
'url'
);
var
app
=
http
.
createServer
(
function
(
request
,
response
){
var
_url
=
request
.
url
;
var
queryData
=
url
.
parse
(
_url
,
true
).
query
;
if
(
_url
==
'/'
){
_url
=
'/Index.html'
;
}
if
(
_url
==
'/favicon.ico'
){
return
response
.
writeHead
(
404
);
}
response
.
writeHead
(
200
);
console
.
log
(
queryData
.
busNum
);
if
(
queryData
.
busNum
!=
null
){
// 버스번호를 요청했을때 타임테이블 페이지로 전환
var
timetableHTML
=
`
<!doctype html>
<html>
<head>
<title>Time Table</title>
<meta charset="utf-8">
<style type="text/css">
a { text-decoration:none }
</style>
</head>
<body>
<h1><a href="Index.html"><p style="text-align:center;">BTT</p></a></h1>
<br>
<h2>
${
queryData
.
busNum
}
BUS Time Table</h2>
<p> Response from API server ... </p>
</body>
</html>
`
;
response
.
end
(
timetableHTML
);
}
else
{
// 아니라면, url 따라감
response
.
end
(
fs
.
readFileSync
(
__dirname
+
_url
));
}
});
app
.
listen
(
23023
);
\ No newline at end of file
Please
register
or
login
to post a comment