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
91d343d5
Commit
91d343d5
authored
Sep 24, 2020
by
Choi Ga Young
Browse files
서버
parent
13a6ac56
Changes
4
Hide whitespace changes
Inline
Side-by-side
server/app.js
View file @
91d343d5
var
createError
=
require
(
'
http-errors
'
);
const
createError
=
require
(
'
http-errors
'
);
var
express
=
require
(
'
express
'
);
const
express
=
require
(
'
express
'
);
var
path
=
require
(
'
path
'
);
const
path
=
require
(
'
path
'
);
var
cookieParser
=
require
(
'
cookie-parser
'
);
const
cookieParser
=
require
(
'
cookie-parser
'
);
var
logger
=
require
(
'
morgan
'
);
const
logger
=
require
(
'
morgan
'
);
const
port
=
3030
;
require
(
'
dotenv
'
).
config
();
var
indexRouter
=
require
(
'
./routes/index
'
);
const
indexRouter
=
require
(
'
./routes/index
'
);
var
usersRouter
=
require
(
'
./routes/users
'
);
const
usersRouter
=
require
(
'
./routes/users
'
);
const
connect
=
require
(
'
./schemas
'
);
var
app
=
express
();
const
app
=
express
();
connect
();
const
port
=
3030
;
app
.
listen
(
port
,
()
=>
console
.
log
(
port
));
app
.
listen
(
port
,
()
=>
console
.
log
(
port
));
// view engine setup
app
.
set
(
'
views
'
,
path
.
join
(
__dirname
,
'
views
'
));
app
.
set
(
'
view engine
'
,
'
pug
'
);
app
.
use
(
logger
(
'
dev
'
));
app
.
use
(
logger
(
'
dev
'
));
app
.
use
(
express
.
json
());
app
.
use
(
express
.
json
());
...
@@ -25,6 +24,8 @@ app.use(express.static(path.join(__dirname, 'public')));
...
@@ -25,6 +24,8 @@ app.use(express.static(path.join(__dirname, 'public')));
app
.
use
(
'
/
'
,
indexRouter
);
app
.
use
(
'
/
'
,
indexRouter
);
app
.
use
(
'
/users
'
,
usersRouter
);
app
.
use
(
'
/users
'
,
usersRouter
);
app
.
listen
(
port
,
()
=>
console
.
log
(
port
));
// catch 404 and forward to error handler
// catch 404 and forward to error handler
app
.
use
(
function
(
req
,
res
,
next
)
{
app
.
use
(
function
(
req
,
res
,
next
)
{
next
(
createError
(
404
));
next
(
createError
(
404
));
...
...
server/views/error.pug
deleted
100644 → 0
View file @
13a6ac56
extends layout
block content
h1= message
h2= error.status
pre #{error.stack}
server/views/index.pug
deleted
100644 → 0
View file @
13a6ac56
extends layout
block content
h1= title
p Welcome to #{title}
server/views/layout.pug
deleted
100644 → 0
View file @
13a6ac56
doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
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