본문 바로가기

node js

Node Js 디버깅 Node Js Debug node js를 디버깅 할 수 있는 방법은 여러가지가 있습니다. 현재 개발환경은 node js 4.x이므로 V8 debugger protocol를 선택합니다. Visual Source Code를 이용할 수도 있습니다. node js에 기본으로 포함된 debugger를 사용해보도록 하겠습니다. 자세한 사용법 문서는 여기를 참조하세요. 기본 명령은 다음과 같습니다. cont 또는 c - 계속 실행 next 또는 n - 다음 라인으로 이동 step 또는 s - step in out 또는 o - step out pause - 일시 정지 브레이크는 debuger를 코드 사이에 삽입하거나 다음의 명령을 사용합니다. sb() - 현재라인에 브레이크 설정 sb(line) - line 번째에 브.. 더보기
Node js를 이용한 Daemon 실행 Node js를 이용한 Daemon 실행 node js에서 데몬형식으로 띄우기 위하여 forever를 이용할 수 있습니다. 먼저 forever를 설치해보도록 하겠습니다. $ sudo npm install -g forever [sudo] password for udooer: npm WARN optional dep failed, continuing fsevents@1.1.1 /usr/local/bin/forever -> /usr/local/lib/node_modules/forever/bin/forever forever@0.15.3 /usr/local/lib/node_modules/forever ├── path-is-absolute@1.0.1 ├── object-assign@3.0.0 ├── clone@1.0.. 더보기
Node js 의 앱을 우분투 부팅시 실행하기 Node js 의 앱을 우분투 부팅시 실행하기 mobius.js (node js로 구동되는 app) 를 우분투 부팅과 동시에 실행하기 위하여 /etc/init/{server name}.conf 를 생성합니다. $ sudo -s $ cd /etc/init/ $ nano mobius.conf 그리고 다음과 같은 내용을 붙여 넣습니다. description "mobius.js" author "your name" # used to be: start on startup # until we found some mounts weren't ready yet while booting start on started mountall stop on shutdown # automatically respawn respawn re.. 더보기