Showing
8 changed files
with
78 additions
and
34 deletions
| ... | @@ -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,11 +17,11 @@ app.use(logger('dev')); | ... | @@ -17,11 +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, '/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) { | ... | ... |
| ... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
| 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", |
| ... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ |
| 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 | + "nodemon": "^2.0.6", | ||
| 14 | "pug": "2.0.0-beta11" | 15 | "pug": "2.0.0-beta11" |
| 15 | } | 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 | -}); | ||
| 8 | -router.get('/category',function(req,res){ | ||
| 9 | - var location = req.query.location; | ||
| 10 | - res.render('category'); | ||
| 11 | }); | 7 | }); |
| 12 | module.exports = router; | 8 | 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 | ... | ... |
14.7 KB
views/base.pug
deleted
100644 → 0
| 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="여주시") 여주시 | ||
| 40 | + | ||
| 41 | + select(name="ku") | ||
| 42 | + option(value="select") 구 | ||
| 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 | + | ||
| 2 | 66 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 3 | -block content | ||
| 4 | - h1= title | ||
| 5 | - p Welcome to #{title} | ... | ... |
-
Please register or login to post a comment