Suyeon Jung

Modify index and select view

...@@ -6,7 +6,7 @@ var logger = require('morgan'); ...@@ -6,7 +6,7 @@ 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 -var loginRouter = require('./routes/login') 9 +var selectRouter = require('./routes/select')
10 var app = express(); 10 var app = express();
11 var bodyParser = require('body-parser'); 11 var bodyParser = require('body-parser');
12 // view engine setup 12 // view engine setup
...@@ -17,27 +17,27 @@ app.use(logger('dev')); ...@@ -17,27 +17,27 @@ 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, '/imgs'))); //정적파일 위치 20 +app.use(express.static(path.join(__dirname, '/static'))); //정적파일 위치
21 app.use('/', indexRouter); 21 app.use('/', indexRouter);
22 app.use('/users', usersRouter); 22 app.use('/users', usersRouter);
23 -app.use('/login', loginRouter) 23 +app.use('/select', selectRouter)
24 -app.use(bodyParser.urlencoded({extended : false})); 24 +app.use(bodyParser.urlencoded({ extended: false }));
25 25
26 // catch 404 and forward to error handler 26 // catch 404 and forward to error handler
27 app.use(function(req, res, next) { 27 app.use(function(req, res, next) {
28 - next(createError(404)); 28 + next(createError(404));
29 }); 29 });
30 30
31 // error handler 31 // error handler
32 app.use(function(err, req, res, next) { 32 app.use(function(err, req, res, next) {
33 - // set locals, only providing error in development 33 + // set locals, only providing error in development
34 - res.locals.message = err.message; 34 + res.locals.message = err.message;
35 - res.locals.error = req.app.get('env') === 'development' ? err : {}; 35 + res.locals.error = req.app.get('env') === 'development' ? err : {};
36 36
37 - // render the error page 37 + // render the error page
38 - res.status(err.status || 500); 38 + res.status(err.status || 500);
39 - res.render('error'); 39 + res.render('error');
40 }); 40 });
41 41
42 42
43 -module.exports = app; 43 +module.exports = app;
...\ No newline at end of file ...\ No newline at end of file
......
1 { 1 {
2 - "name": "ur-village", 2 + "name": "ur-village",
3 - "version": "0.0.0", 3 + "version": "0.0.0",
4 - "private": true, 4 + "private": true,
5 - "scripts": { 5 + "scripts": {
6 - "start": "node ./bin/www" 6 + "start": "nodemon ./bin/www"
7 - }, 7 + },
8 - "dependencies": { 8 + "dependencies": {
9 - "cookie-parser": "~1.4.4", 9 + "cookie-parser": "~1.4.4",
10 - "debug": "~2.6.9", 10 + "debug": "~2.6.9",
11 - "express": "~4.16.1", 11 + "express": "~4.16.1",
12 - "http-errors": "~1.6.3", 12 + "http-errors": "~1.6.3",
13 - "morgan": "~1.9.1", 13 + "morgan": "~1.9.1",
14 - "pug": "2.0.0-beta11" 14 + "nodemon": "^2.0.6",
15 - } 15 + "pug": "2.0.0-beta11"
16 + }
16 } 17 }
......
...@@ -3,10 +3,6 @@ var router = express.Router(); ...@@ -3,10 +3,6 @@ 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('base', { title: 'Express' }); 6 + res.render('index');
7 }); 7 });
8 -router.get('/category',function(req,res){ 8 +module.exports = router;
9 - var location = req.query.location;
10 - res.render('category');
11 -});
12 -module.exports = router;
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,10 +3,8 @@ var router = express.Router(); ...@@ -3,10 +3,8 @@ var router = express.Router();
3 3
4 /* GET home page. */ 4 /* GET home page. */
5 5
6 -router.get('/login',function(req,res){ 6 +router.post('/', function(req, res) {
7 - var location = req.query.location; 7 + res.render('select', { 'si': req.body.si, 'ku': req.body.ku });
8 - res.render('category'); 8 +});
9 - res.send(location);
10 - });
11 9
12 -module.exports = router; 10 +module.exports = router;
...\ No newline at end of file ...\ No newline at end of file
......
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
1 -extends layout 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.image(src='/logo.png')
9 + form(action='/select' method='post' id='location')
10 + select(name="si")
11 + option(value="select") 시
12 + option(value="수원시") 수원시
13 + option(value="성남시") 성남시
14 + option(value="의정부시") 의정부시
15 + option(value="안양시") 안양시
16 + option(value="부천시") 부천시
17 + option(value="광명시") 광명시
18 + option(value="평택시") 평택시
19 + option(value="동두천시") 동두천시
20 + option(value="안산시") 안산시
21 + option(value="고양시") 고양시
22 + option(value="과천시") 과천시
23 + option(value="구리시") 구리시
24 + option(value="남양주시") 남양주시
25 + option(value="오산시") 오산시
26 + option(value="시흥시") 시흥시
27 + option(value="군포시") 군포시
28 + option(value="의왕시") 의왕시
29 + option(value="하남시") 하남시
30 + option(value="용인시") 용인시
31 + option(value="파주시") 파주시
32 + option(value="이천시") 이천시
33 + option(value="안성시") 안성시
34 + option(value="김포시") 김포시
35 + option(value="화성시") 화성시
36 + option(value="광주시") 광주시
37 + option(value="양주시") 양주시
38 + option(value="포천시") 포천시
39 + option(value="여주시") 여주시
2 40
3 -block content 41 + select(name="ku")
4 - h1= title 42 + option(value="select") 구
5 - p Welcome to #{title} 43 + option(value="장안구") 장안구
44 + option(value="권선구") 권선구
45 + option(value="팔달구") 팔달구
46 + option(value="영통구") 영통구
47 + option(value="수정구") 수정구
48 + option(value="중원구") 중원구
49 + option(value="분당구") 분당구
50 + option(value="만안구") 만안구
51 + option(value="동안구") 동안구
52 + option(value="원미구") 원미구
53 + option(value="소사구") 소사구
54 + option(value="오정구") 오정구
55 + option(value="상록구") 상록구
56 + option(value="단원구") 단원구
57 + option(value="덕양구") 덕양구
58 + option(value="일산동구") 일산동구
59 + option(value="일산서구") 일산서구
60 + option(value="처인구") 처인구
61 + option(value="기흥구") 기흥구
62 + option(value="수지구") 수지구
63 + input(type ='submit')
64 +
65 +
66 +
...\ No newline at end of file ...\ No newline at end of file
......
1 -doctype html 1 +//- doctype html
2 html 2 html
3 head 3 head
4 if location =="n" 4 if location =="n"
5 button k 5 button k
6 body 6 body
7 block content 7 block content
8 + h1 #{si}
9 + h1 #{ku}
8 10
......