Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
reservation-service
Commits
81cf8c01
Commit
81cf8c01
authored
Nov 06, 2020
by
Yoon, Daeki
😅
Browse files
root url
parent
49cf22e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/express.js
View file @
81cf8c01
...
@@ -11,6 +11,13 @@ const reservesRouter = require('./routes/reserves');
...
@@ -11,6 +11,13 @@ const reservesRouter = require('./routes/reserves');
const
noticeRouter
=
require
(
'
./routes/notices
'
);
const
noticeRouter
=
require
(
'
./routes/notices
'
);
const
writesRouter
=
require
(
'
./routes/writes
'
);
const
writesRouter
=
require
(
'
./routes/writes
'
);
// 배포용?
const
isProduction
=
process
.
env
.
NODE_ENV
===
'
production
'
let
root_url
=
'
/
'
if
(
isProduction
)
{
root_url
=
'
/app/rental
'
}
const
CURRENT_WORKING_DIR
=
process
.
cwd
()
const
CURRENT_WORKING_DIR
=
process
.
cwd
()
const
app
=
express
()
const
app
=
express
()
...
@@ -22,12 +29,12 @@ app.use(cors())
...
@@ -22,12 +29,12 @@ app.use(cors())
console
.
log
(
'
path=
'
,
path
.
join
(
CURRENT_WORKING_DIR
,
'
client
'
,
'
build
'
))
console
.
log
(
'
path=
'
,
path
.
join
(
CURRENT_WORKING_DIR
,
'
client
'
,
'
build
'
))
app
.
use
(
'
/
'
,
express
.
static
(
path
.
join
(
CURRENT_WORKING_DIR
,
'
client
'
,
'
build
'
)))
app
.
use
(
'
/
'
,
express
.
static
(
path
.
join
(
CURRENT_WORKING_DIR
,
'
client
'
,
'
build
'
)))
app
.
use
(
'
/api/
'
,
indexRouter
);
app
.
use
(
path
.
join
(
root_url
,
'
/api/
'
)
,
indexRouter
);
app
.
use
(
'
/api/users
'
,
usersRouter
,
reservesRouter
);
app
.
use
(
path
.
join
(
root_url
,
'
/api/users
'
)
,
usersRouter
,
reservesRouter
);
app
.
use
(
'
/api/login
'
,
loginRouter
);
app
.
use
(
path
.
join
(
root_url
,
'
/api/login
'
)
,
loginRouter
);
app
.
use
(
'
/api/reserves
'
,
reservesRouter
);
app
.
use
(
path
.
join
(
root_url
,
'
/api/reserves
'
)
,
reservesRouter
);
app
.
use
(
'
/api/notices
'
,
noticeRouter
);
app
.
use
(
path
.
join
(
root_url
,
'
/api/notices
'
)
,
noticeRouter
);
app
.
use
(
'
/api/writes
'
,
writesRouter
);
app
.
use
(
path
.
join
(
root_url
,
'
/api/writes
'
)
,
writesRouter
);
app
.
use
((
err
,
req
,
res
,
next
)
=>
{
app
.
use
((
err
,
req
,
res
,
next
)
=>
{
if
(
err
.
name
===
'
UnauthorizedError
'
)
{
if
(
err
.
name
===
'
UnauthorizedError
'
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment