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

<br>
           				<table	id="comment-list">
           						<thead>
           						<tr>
           								<th>아이디</th>
           								<th>작성자</th>
           								<th>댓글</th>
           								<th>수정</th>
           								<th>삭제</th>
           						</tr>
           						</thead>
           						<tbody></tbody>
           				</table>
           				<script	src="https://unpkg.com/axios/dist/axios.min.js"></script>
           				<script	src="/sequelize.js"></script>
           		</body>
           </html>



          views/error.html

           <h1>{{message}}</h1>
           <h2>{{error.status}}</h2>
           <pre>{{error.stack}}</pre>




         QVCMJD ಫ؊ উী TFRVFMJ[F KT ౵ੌب ٟ݅פ׮

          public/sequelize.js

           //	사용자	이름을	눌렀을	때	댓글	로딩
           document.querySelectorAll('#user-list	tr').forEach((el)	=>	{
           		el.addEventListener('click',	function	()	{
           				const	id	=	el.querySelector('td').textContent;
           				getComment(id);
           		});
           });
           //	사용자	로딩
           async	function	getUser()	{
           		try	{
           				const	res	=	await	axios.get('/users');
           				const	users	=	res.data;
           				console.log(users);
           				const	tbody	=	document.querySelector('#user-list	tbody');
           				tbody.innerHTML	=	'';
           				users.map(function	(user)	{
           						const	row	=	document.createElement('tr');
   314   315   316   317   318   319   320   321   322   323   324