Showing
6 changed files
with
45 additions
and
6 deletions
... | @@ -6,9 +6,9 @@ var logger = require('morgan'); | ... | @@ -6,9 +6,9 @@ var logger = require('morgan'); |
6 | 6 | ||
7 | var indexRouter = require('./routes/index'); | 7 | var indexRouter = require('./routes/index'); |
8 | var usersRouter = require('./routes/users'); | 8 | var usersRouter = require('./routes/users'); |
9 | - | 9 | +var loginRouter = require('./routes/login') |
10 | var app = express(); | 10 | var app = express(); |
11 | - | 11 | +var bodyParser = require('body-parser'); |
12 | // view engine setup | 12 | // view engine setup |
13 | app.set('views', path.join(__dirname, 'views')); | 13 | app.set('views', path.join(__dirname, 'views')); |
14 | app.set('view engine', 'pug'); | 14 | app.set('view engine', 'pug'); |
... | @@ -17,10 +17,11 @@ app.use(logger('dev')); | ... | @@ -17,10 +17,11 @@ app.use(logger('dev')); |
17 | app.use(express.json()); | 17 | app.use(express.json()); |
18 | app.use(express.urlencoded({ extended: false })); | 18 | app.use(express.urlencoded({ extended: false })); |
19 | app.use(cookieParser()); | 19 | app.use(cookieParser()); |
20 | -app.use(express.static(path.join(__dirname, 'public'))); | 20 | +app.use(express.static(path.join(__dirname, '/imgs'))); //정적파일 위치 |
21 | - | ||
22 | app.use('/', indexRouter); | 21 | app.use('/', indexRouter); |
23 | app.use('/users', usersRouter); | 22 | app.use('/users', usersRouter); |
23 | +app.use('/login', loginRouter) | ||
24 | +app.use(bodyParser.urlencoded({extended : false})); | ||
24 | 25 | ||
25 | // catch 404 and forward to error handler | 26 | // catch 404 and forward to error handler |
26 | app.use(function(req, res, next) { | 27 | app.use(function(req, res, next) { |
... | @@ -38,4 +39,5 @@ app.use(function(err, req, res, next) { | ... | @@ -38,4 +39,5 @@ app.use(function(err, req, res, next) { |
38 | res.render('error'); | 39 | res.render('error'); |
39 | }); | 40 | }); |
40 | 41 | ||
42 | + | ||
41 | module.exports = app; | 43 | module.exports = app; | ... | ... |
imgs/logo.png
0 → 100644
14.7 KB
... | @@ -3,7 +3,10 @@ var router = express.Router(); | ... | @@ -3,7 +3,10 @@ var router = express.Router(); |
3 | 3 | ||
4 | /* GET home page. */ | 4 | /* GET home page. */ |
5 | router.get('/', function(req, res, next) { | 5 | router.get('/', function(req, res, next) { |
6 | - res.render('index', { title: 'Express' }); | 6 | + res.render('base', { title: 'Express' }); |
7 | +}); | ||
8 | +router.get('/category',function(req,res){ | ||
9 | + var location = req.query.location; | ||
10 | + res.render('category'); | ||
7 | }); | 11 | }); |
8 | - | ||
9 | module.exports = router; | 12 | module.exports = router; | ... | ... |
routes/login.js
0 → 100644
views/base.pug
0 → 100644
1 | +doctype html | ||
2 | +html | ||
3 | + head | ||
4 | + title= title | ||
5 | + link(rel='stylesheet', href='/stylesheets/style.css') | ||
6 | + body | ||
7 | + block content | ||
8 | + <img src="./logo.png" alt ="error"> | ||
9 | + form(action ='/category' method = 'get') | ||
10 | + p | ||
11 | + input(type='text' name = 'location') | ||
12 | + input(type ='submit') | ||
13 | + | ||
14 | + | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment