Toggle navigation
Toggle navigation
This project
Loading...
Sign in
오인제
/
Tunnel
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-12-04 23:40:30 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ecb220a62d1a3933901f58a451a783909043b0c1
ecb220a6
1 parent
c988b234
Change routes
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
10 deletions
.gitignore
tunnel_BE/server/routes/index.js
tunnel_BE/server/routes/login.js
tunnel_BE/server/server.js
.gitignore
0 → 100644
View file @
ecb220a
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
tunnel_BE/server/routes/index.js
View file @
ecb220a
...
...
@@ -3,7 +3,8 @@ const path = require("path");
const
router
=
express
.
Router
();
router
.
get
(
'/'
,(
req
,
res
)
=>
{
res
.
sendFile
(
path
.
join
(
__dirname
,
'../../../turnel_FE/public/index.html'
));
})
// res.sendFile(path.join(__dirname, '../../../turnel_FE/public/index.html'));
res
.
send
(
"index"
);
});
module
.
exports
=
router
;
\ No newline at end of file
...
...
tunnel_BE/server/routes/login.js
View file @
ecb220a
...
...
@@ -6,13 +6,15 @@ router.get('/',(req,res)=>{
res
.
send
(
'로그인 페이지'
);
});
//라우트 매개변수사용
//
뒤에
위치 요구
//
후방
위치 요구
router
.
get
(
"/:id"
,(
req
,
res
)
=>
{
console
.
log
(
req
.
params
,
req
.
quer
y
);
re
q
.
body
;
console
.
log
(
req
.
bod
y
);
re
s
.
json
({
id
:
"oss_hi"
})
;
});
module
.
exports
=
router
;
\ No newline at end of file
...
...
tunnel_BE/server/server.js
View file @
ecb220a
...
...
@@ -8,17 +8,18 @@ const bodyParser = require("body-parser");
dotenv
.
config
();
const
indexRouter
=
require
(
'./routes/index.js'
);
const
user
Router
=
require
(
'./routes/login.js'
);
const
login
Router
=
require
(
'./routes/login.js'
);
const
registerRouter
=
require
(
'./routes/regiser.js'
);
const
app
=
express
();
app
.
set
(
'port'
,
process
.
env
.
PORT
||
300
0
);
app
.
set
(
'port'
,
process
.
env
.
PORT
||
300
1
);
const
port
=
app
.
get
(
'port'
);
//미들웨어 설정
app
.
use
(
morgan
(
'dev'
));
app
.
use
(
express
.
json
());
//json형식으로 데이터 전달
app
.
use
(
express
.
urlencoded
({
extende
:
false
}));
// url형식으로 형식으로 데이터 전달
app
.
use
(
bodyParser
().
json
);
app
.
use
(
cookieParser
(
process
.
env
.
COOKIE_SECRET
));
app
.
use
(
session
({
resave
:
false
,
...
...
@@ -31,10 +32,13 @@ app.use(session({
name
:
'session-cookie'
,
}));
//라우팅
app
.
use
(
'/'
,
indexRouter
);
app
.
use
(
'/login'
,
userRouter
);
app
.
use
(
'/register'
,
registerRouter
);
//app.use('/',indexRouter);
//app.use('/login',loginRouter);
app
.
use
(
'/'
,
loginRouter
);
//로그인 페이지
app
.
use
(
'/register'
,
registerRouter
);
// 회원가입 페이지
//에러처리 미들웨어
...
...
Please
register
or
login
to post a comment