Commit 91d343d5 authored by Choi Ga Young's avatar Choi Ga Young
Browse files

서버

parent 13a6ac56
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));
......
extends layout
block content
h1= message
h2= error.status
pre #{error.stack}
extends layout
block content
h1= title
p Welcome to #{title}
doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment