이학주

Add index, category View

......@@ -6,9 +6,9 @@ var logger = require('morgan');
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var loginRouter = require('./routes/login')
var app = express();
var bodyParser = require('body-parser');
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
......@@ -17,10 +17,11 @@ app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, '/imgs'))); //정적파일 위치
app.use('/', indexRouter);
app.use('/users', usersRouter);
app.use('/login', loginRouter)
app.use(bodyParser.urlencoded({extended : false}));
// catch 404 and forward to error handler
app.use(function(req, res, next) {
......@@ -38,4 +39,5 @@ app.use(function(err, req, res, next) {
res.render('error');
});
module.exports = app;
......

14.7 KB

......@@ -3,7 +3,10 @@ var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
res.render('base', { title: 'Express' });
});
router.get('/category',function(req,res){
var location = req.query.location;
res.render('category');
});
module.exports = router;
......
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/login',function(req,res){
var location = req.query.location;
res.render('category');
res.send(location);
});
module.exports = router;
doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
<img src="./logo.png" alt ="error">
form(action ='/category' method = 'get')
p
input(type='text' name = 'location')
input(type ='submit')
\ No newline at end of file
doctype html
html
head
if location =="n"
button k
body
block content