Koa vs Express
Koajs 와 Expressjs 는 server를 구현할 때 많이 사용된다.
사용법이나 초기 세팅하는 방법에 대해서는 아래의 도큐를 참고하자
1. Koa
Koa - next generation web framework for node.js
Introduction Koa is a new web framework designed by the team behind Express, which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs. By leveraging async functions, Koa allows you to ditch callbacks and greatly
koajs.com
2. Express
Express - Node.js web application framework
Fast, unopinionated, minimalist web framework for Node.js $ npm install express --save
expressjs.com
둘의 차이점
Koa는 Low level의 개발 단계에서 유용하다. 그래서 View && Routing 이 충분하게 구현되어 있지 않지만, 초기 세팅이 매우 라이트하여 메모리 측면에서 효율성이 뛰어나다. 그리고 Koa는 Middleware chain이 Promise-based로 되어 있다.
반면, Express는 View && Routing 초기 세팅으로 구현되어 있어, 단일 SPA 구현에 보다 효율적이다. 하지만, Server에게 불필요한 기능이 포함 되어 있어 메모리 측면에서 비효율적인 부분도 있다. Express는 Middleware chain이 callback-based로 되어 있다.
결론 요즘은 express가 대세다. 왜냐면 사람들이 많이 쓰고 활발하게 업데이트가 되기 때문이다.
참고