일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Get
- 개발일지
- Transaction
- NoSQL
- db
- 스파르타코딩클럽
- nginx
- SQL
- HTTPS
- 부트스트랩
- JWT
- OpenAPI
- 3주차
- 4주차
- 항해99
- 5주차
- Sequelize
- Node.js
- 1주차
- MongoDB
- 숙제
- 웹 스크래핑(크롤링)
- node winston
- 노드 윈스턴
- 2주차
- 트랜잭션
- cors
- 비동기
- post
- 위키백과
Archives
- Today
- Total
얼음꽃의 일지
Express 얘는 뭐꼬? 본문
728x90
Express
-> Node.js를 위한 Web FrameWork 중 하나
-> 쉽게 서버를 구성할 수 있게 만든 클래스와 미들웨어, 라이브러리의 집합체
-> 웹 애플리케이션을 만들 수 있음
-> 만약 Express를 대체해야 한다면 Express가 현재 MIT쪽에 팔렸기에 Express를 만든 회사꺼인 Koa를 사용
Express 가 편한 이유
// Node.js 내장된 HTTP로 웹 서버 띄우기
const http = require('http');
http.createServer(request, response) {
http.createServer(function(request, response){
response.writeHead(200, {'Content-Type':'text/html'});
response.write('웹서버 띄우기')
response.end();
}).listen(3000, function(){
console.log("3000번으로 열었음");
});
// Express 사용해서 웹 서버 띄우기
const express = require('express');
const app = express();
const port = 3000;
app.listen(port, () => {
console.log("3000번으로 열었음");
});
// Koa 사용해서 웹 서버 띄우기
const koa = require('koa');
const app = express();
const port = 3000;
app.listen(port, () => {
console.log("3000번으로 열었음");
});
728x90
'항해 일지' 카테고리의 다른 글
Nginx 와 Apache (0) | 2022.12.18 |
---|---|
npm(Node Packaged Manager) (0) | 2022.12.18 |
화살표 함수 (0) | 2022.12.18 |
async & await (1) | 2022.12.18 |
호이스팅? Hoisting? (0) | 2022.12.18 |