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

.env
           COOKIE_SECRET=cookiesecret




         ೞ٘ ௏٬ػ ࠺޻ߣഐо ਬੌೞѱ թই ੓ח ౵ੌ੉ ੓णפ׮  द௬ۄ੉ૉ ࢸ੿ਸ ׸ইك DPOGJH KTPO੉ݴ  +40

         / ౵ੌ੉ۄ process.envܳ ࢎਊೡ ࣻ হणפ׮  द௬ۄ੉ૉ੄ ࠺޻ߣഐܳ ऀӝח ߑߨ਷       ੺ীࢲ ঌইࠇ
         פ׮


         ӝࠄ੸ੋ ۄ਋ఠ৬ మ೒݁ ূ૓ب ٜ݅যࠇद׮  SPVUFT ಫ؊ উীח QBHF KTܳ  WJFXT ಫ؊ উীח MBZPVU IU
         NM  NBJO IUNM  QSPGJMF IUNM  KPJO IUNM  FSSPS IUNMਸ ࢤࢿ೤פ׮  ডр੄ ٣੗ੋਸ ਤ೧ NBJO DTTܳ QVCMJ

         D ಫ؊ উী ࢤࢿ೤פ׮

          routes/page.js

           const	express	=	require('express');


           const	router	=	express.Router();


           router.use((req,	res,	next)	=>	{
           		res.locals.user	=	null;
           		res.locals.followerCount	=	0;
           		res.locals.followingCount	=	0;
           		res.locals.followerIdList	=	[];
           		next();
           });


           router.get('/profile',	(req,	res)	=>	{
           		res.render('profile',	{	title:	'내	정보	-	NodeBird'	});
           });


           router.get('/join',	(req,	res)	=>	{
           		res.render('join',	{	title:	'회원가입	-	NodeBird'	});
           });


           router.get('/',	(req,	res,	next)	=>	{
           		const	twits	=	[];
           		res.render('main',	{
           				title:	'NodeBird',
           				twits,
           		});
           });


           module.exports	=	router;
   383   384   385   386   387   388   389   390   391   392   393