TIL | WIL

3/14 화 (ejs는 일일이 눈으로 검사해서 에러를 찾아야 함이 불편) TIL, TIT

깊은바다거북 2023. 4. 6. 20:44

(최종 프로젝트 진행중)

내일이면 중간 완성을 해야 한다.

오늘 만든 부분:

  • 품앗이 신청 목록 보기 페이지
  • 품앗이 상세조회(지원) 페이지


※ 이하는 스스로 공부하며 적어둔 노트이며 불확실한 내용이 있을 수 있습니다. 학습용으로 적합하지 않음을 유념해주세요. ※

[ejs] 에러 SyntaxError: missing ) after argument list in while compiling ejs

아무리 찾아봐도 안됐었는데 문제가 생겼다는 ejs 파일에

<%= 품앗이 게시판%>이라고, 변수가 아닌 그냥 제목을 넣어버려서 그랬던 것이엇다.

에러 Uncaught ReferenceError: $ is not defined

ejs 파일에서 이처럼 <head> 안에 (어쨌든 상단에) jQuery를 임포트하면 괜찮은데,

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="short icon" href="#">
  <title>무인냥품</title>

  <!-- bootstrap -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">

  <!-- styles -->
  <link rel="stylesheet" href="/css/header/mainHeader.css">
  <link rel="stylesheet" href="/css/header/basicHeader.css">
  <link rel="stylesheet" href="/css/footer/footer.css">
  <link rel="stylesheet" href="/css/index/index.css">
  <link rel="stylesheet" href="/css/main/main.css">
  <link rel="stylesheet" href="/css/myPage/myPage.css">
  
  <!-- jquery -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>

</head>

아래처럼 <body>의 최하단에 두면 위와 같은 에러가 난다.

...
	<!-- bootstrap -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>

	<!-- jquery -->
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>

</body>
</html>

전에 script는 최대한 아래에 두라고 했던 것 같은데 왜 얘는 반대로 작동하고 있는지 모르겠다.

[Nest.js] cookie로 하는 로그인 인증 처리하기

req.user를 계속 못 받아오다가 공식 문서 첫머리에 바로 cookie-parser가 전역으로 필요하다고 해서 설정해주니 해결됐다.

Documentation | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
https://docs.nestjs.com/techniques/cookies

hot-reload (새로 고침 안해도 브라우저 페이지 자동 업데이트)

를 알아보고 있었다. 검색어 “nest-cli json watchassets”


Uploaded by N2T