Server/Node.js
-
Error HandlingServer/Node.js 2022. 11. 20. 23:13
1. 에러 핸들링의 목적과 의의 1.1 [why] 에러 핸들링 목적 - 소프트웨어는 에러와 예외가 늘 발생하여 정상적인 사용 흐름이 막히게 된다. 에러가 발생하는 원인은 개발자의 실수도 있지만 사용자의 실행 환경, 사용자의 특성 등 다양하기 때문이다. - 그리고 에러가 발생하면 서버는 작동을 멈춘다. 그래서 개발자는 사용자가 서비스를 이용하는 동안 발생할 수 있는 에러를 예측하여 사용자의 사용 흐름이 막히지 않도록 유도해야 한다. 이런 과정을 에러 핸들링이라고 한다. - 하지만 모든 에러를 개발자가 예측할 수는 없다. 따라서 예외 상황에 소프트웨어가 갑자기 종료되기보다는 에러가 발생했음을 알리고 서비스가 곧 정상 작동할 것임을 안내하는 것이 좋다. - 이러한 에러 핸들링은 사용자로 하여금 서비스가 다시 ..
-
[HOW] Node.js 모듈 시스템Server/Node.js 2022. 10. 30. 13:15
[이전 글 참고] 1. [WHAT] Node.js란 무엇인가? : https://growth-msleeffice.tistory.com/51 2. [WHY] Node.js 기반으로 API 서버를 구축하면 좋은 이유 : https://growth-msleeffice.tistory.com/52 3. [How] Node.js 모듈 시스템 3.1 Custom 모듈 만들기 모듈도 LEGO 블록과 마찬가지로 코드의 조각으로, 여러 모듈이 조합되어 하나의 소프트웨어를 이루게 됩니다. 즉, 프로그램을 만들 때 코드를 잘 모듈화해서 만들게 되면, 유지보수하기 쉬운 구조로 시스템을 만들 수 있습니다. 결국에는 모듈화가 잘 된 코드는 재사용성과 확장성을 높여 새로운 기능을 개발하거나 유지보수 할 때, 전체적인 비용을 감소시키..
-
[WHY] Node.js 기반으로 API 서버를 구축하면 좋은 이유Server/Node.js 2022. 10. 30. 13:13
[이전 글 참고] 1. [WHAT] Node.js란 무엇인가? : https://growth-msleeffice.tistory.com/51 [다음 글 참고] 3. Node.js 모듈 시스템 : https://growth-msleeffice.tistory.com/53 2. [Why] Node.js 기반으로 API 서버를 구축하면 좋은 이유 2.1 frontend와 backend 기술 스택 통합 - 클라이언트와 서버의 동일한 언어 사용으로 코드를 모듈로 만들어서 "재사용"가능 - FE개발자 서버 프로그래밍 접근성 향상 - 개발팀 생산성 향상 2.2 빠른 처리속도, 동시요청 처리 성능 - V8 엔진은 JIT 컴파일 방식, V8의 최적화 기법으로 놀라운 속도로 작업을 수행한다. - libuv라는 비동기 I/O에..
-
[WHAT] Node.js란 무엇인가?Server/Node.js 2022. 10. 30. 13:11
이번 주, 위코드에서 Node.js 세션이 시작되었다. JavaScript로 간단한 기능들을 구현하거나 문제풀이 했던 것과는 다르게 filesystem 객체를 활용해 가상의 데이터베이스에서 데이터를 뽑아오는 것도 해보고, GET, POST, PATCH, DELETE API도 구현해보면서 보다 실무와 가까워지는 느낌이 들어 뿌듯했다! 아직 클라이언트, 데이터베이스와 연결하는 작업은 하지 않았지만, 연결되었을 때를 상상하며 학습하고 과제를 완수했다. 멘토님들께서 보여주신 코드들과 내 코드를 비교해보니 배울 점이 많았다. 내 코드는 의식의 흐름대로 맥락없이 흘러내려간 글이라면, 멘토님들의 코드는 내용별로 단락 구분이 잘 된 정돈된 글이었다. 특히, 인상 깊었던 것은 함수지향 프로그래밍을 하고계신건가? 싶은데 ..