Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이유제
/
CultureGallery
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
송효섭
2020-12-04 05:35:24 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7dc720b515d966805a3c89e3e7aa59f9c7ce5d35
7dc720b5
1 parent
05ffb1ce
morgan logging, js file getter formatted.
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
app.js
app.js
View file @
7dc720b
const
express
=
require
(
'express'
);
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
logger
=
require
(
'morgan'
);
const
app
=
express
();
app
.
use
(
logger
(
'combined'
));
//디폴트 포트 값 : 8000
app
.
set
(
'port'
,
process
.
env
.
PORT
||
8000
);
//get하는 방법 : sendfile(파일 디렉토리 ) : 개선 필요 -> html 페이지 이동 및 data 전달 방법 찾기
app
.
get
(
'/'
,
(
req
,
res
)
=>
{
//res.send('Server is working');
res
.
sendFile
(
path
.
join
(
__dirname
,
'./public/html/main.html'
))
});
app
.
get
(
'/plan'
,
(
req
,
res
)
=>
{
res
.
send
(
'Server is working'
);
res
.
sendFile
(
path
.
join
(
__dirname
,
'./public/html/main.html'
));
console
.
log
(
app
.
get
(
'port'
),
'번 포트 대기 중'
);
//
console.log(app.get('port'), '번 포트 대기 중');
});
app
.
get
(
'/login'
,
(
req
,
res
)
=>
{
console
.
log
(
'로그인 페이지 오픈 시도됨.'
);
//
console.log('로그인 페이지 오픈 시도됨.');
fs
.
readFile
(
'./public/html/login.html'
,
function
(
err
,
data
)
{
res
.
writeHead
(
200
,
{
'Content-Type'
:
'text/html'
});
res
.
end
(
data
);
...
...
Please
register
or
login
to post a comment