Study/Node.js 6

[Node.JS] If the above error is not helpful, you may want to try EJS-Lint 오류

노드js홈페이지에 카운터를 달기 위해 ejs에 Total visitors (today: ) 이렇게 코드를 입력했는데 If the above error is not helpful, you may want to try EJS-Lint 에러가 발생했다. 찾아보니 ejs가 업그레이드 되면서 include하는 방식이 제거되어 에러가 발생했다고 한다. 그래서 counter.totalCount 를 counter('totalCount')로 수정했더니 해결되었다! 문제 해결에 참고한 블로그... 감사합니다. https://prometheo.tistory.com/37

Study/Node.js 2022.12.16

Node.JS에러 - 로그아웃 오류(Error: req#logout requires a callback function)

node프로젝트 작업 중 에러가 났다. stackoverflow를 찾아보니 passport 0.6 출시 이후로 req.logout이 비동기로 변경되어 위 코드로는 작동이 안된다고 한다. 그래서 아래 코드로 수정하였더니 로그아웃이 잘 된다.^^ router.get('/logout', function(req, res, next) { req.logout(function(err) { if (err) { return next(err); } res.redirect('/'); }); }); https://stackoverflow.com/questions/72336177/error-reqlogout-requires-a-callback-function Error: req#logout requires a callback ..

Study/Node.js 2022.11.21

Node.js 에러- Mongo Server Error: user is not allowed to do action [find] on [test.posts]

mongoDB설정을 제대로 하고 환경설정도 했는데도 저 에러가 나서 검색을 돌렸는데 원래 처음 atals쓰는 사람에게 나타나는 오류라고 한다. ㅎㅎ 해결법은 1. SECURITY->Database Access 에 들어간다. 2. 사용자 이름 옆에 있는 EDIT 클릭 3. 귄한을 적당히 부여해준다. 나는 관리자로 설정했다. 끝! 해결법 출처는 이쪽..^_^ https://stackoverflow.com/questions/46649390/mongoerror-user-is-not-allowed-to-do-action

Study/Node.js 2022.10.22

Node.js에러 - node:internal/modules/cjs/loader:936 throw err;

Node.js에서 프로젝트를 만들던 도중 node:internal/modules/cjs/loader:936 throw err; 에러가 났다. https://github.com/nodejs/help/issues/3709 ERROR - node:internal/modules/cjs/loader:936 throw err; · Issue #3709 · nodejs/help Version No response Platform Windows Powershell Subsystem Powershell What steps will reproduce the bug? Downloading node.js > Opening the Windows Powershell > Selecting the Folder > node i... ..

Study/Node.js 2022.10.22

Node.js 미들웨어 사용하기(bodyParser, compression)

오늘도 생활코딩 강의를 들으며 정리한 내용이다. 노드에서 미들웨어를 사용하여 코드를 더욱 간결하게 만드는 방법을 공부했다. bodyParser app.post('/create_process', function(request, response){ var body = ''; request.on('data', function(data){ body = body + data; }); request.on('end', function(){ var post = qs.parse(body); var title = post.title; var description = post.description; fs.writeFile(`data/${title}`, description, 'utf8', function(err){ resp..

Study/Node.js 2022.09.07

Node.js 시멘틱 URL

생활코딩 Node.js 강의를 들으며 정리한 내용을 올립니다. web2강의에서는 쿼리스트링으로 웹페이지를 만들었다. 그런데 강의내용대로 코드를 작성하니 vscode에서 쿼리스트링에 취소선이 그어져 있었다. https://nodejs.org/api/documentation.html#stability-index 여기에 들어가서 쿼리스트링을 찾아보면 이렇게 표기되어있다. 레거시이므로 권장되지 않고 다른 기능을 사용하라는 것 같다. 그렇다면 다른 기능이 무엇일까? 바로 시멘틱URL(Semantic URL)이다. 먼저 쿼리스트링에 대해 알아보자. http://a.com/topic?id=1 http://a.com/topic?id=2 http://a.com/topic?id=3 위의 세 주소는 topic 이라는 같은 ..

Study/Node.js 2022.09.06
1