Page 577 - Nodejs 교과서 개정2판
P. 577

.timeline	{
           		margin-top:	10px;
           		width:	100%;
           		display:	inline-block;
           		border-radius:	4px;
           		vertical-align:	top;
           }
           @media	screen	and	(min-width:	800px)	{	.timeline	{	width:	500px;	}	}
           #good-list,	#good-list	th,	#good-list	td	{
           		border:	1px	solid	black;
           		border-collapse:	collapse;
           }
           #good-list	img	{	max-height:	100px;	vertical-align:	top;	}
           #good-img	{	width:	280px;	display:	block;	}
           .error-message	{	color:	red;	font-weight:	bold;	}
           #join-form,	#good-form	{	padding:	10px;	text-align:	center;	}
           footer	{	text-align:	center;	}




         ݃૑݄ਵ۽ ۄ਋ఠܳ ٟ݅פ׮

          routes/index.js

           const	express	=	require('express');
           const	multer	=	require('multer');
           const	path	=	require('path');
           const	fs	=	require('fs');


           const	{	Good,	Auction,	User	}	=	require('../models');
           const	{	isLoggedIn,	isNotLoggedIn	}	=	require('./middlewares');


           const	router	=	express.Router();


           router.use((req,	res,	next)	=>	{
           		res.locals.user	=	req.user;
           		next();
           });


           router.get('/',	async	(req,	res,	next)	=>	{
           		try	{
           				const	goods	=	await	Good.findAll({	where:	{	SoldId:	null	}	});
           				res.render('main',	{
           						title:	'NodeAuction',
           						goods,
           				});
           		}	catch	(error)	{
   572   573   574   575   576   577   578   579   580   581   582