Notice
Recent Posts
Recent Comments
Link
반응형
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- nodejs
- angular
- 에러
- error
- Array
- node
- Reduce
- npm
- Nextjs
- 노드js
- 코딩테스트연습
- 마음커넥션
- 노드제이에스
- 백엔드
- 프로그래머스
- indexOf
- Javascript
- TypeScript
- 개발
- Method
- codingtest
- 노드
- 앵귤러
- CLI
- react
- 코딩테스트
- slice
- 자바스크립트
- Programmers
- 타입스크립트
Archives
- Today
- Total
Suzie's Blog
[Express] Express Server 구축하는 방법 | 서버가 켜져있는지 확인하는 방법 본문
반응형
SMALL
Express server 구축하는 방법
1. 디렉토리를 생성한다
mkdir directoryName
2. index.js 파일을 만든다
3. npm init 을 실행한다 (-y : yes for every single questions)
npm init -y
4. Express 패키지를 설치한다
npm i Express
5. Server Application을 index.js에 작성해준다
import express from "express";
const app = express();
const port = 1000;
app.listen(port, () => {
console.log(`Server running on port ${port}.`);
});
6. 서버를 켜준다
node index.js
서버가 켜져 있는지 확인하는 방법
1. localhost:1000 으로 접속해서 확인 (Cannot GET \ 이 보이면 연결된것)
2. 터미널에 아래와 같이 입력하면 현재 켜져있는 모든 서버 확인 가능
- Windows : netstat -ano | findstr "LISTENING"
- MAC/Linux : sudo lsof -i -P -n | grep LISTEN
반응형
LIST
'개발' 카테고리의 다른 글
스페이스 대신 /u00A0 || 커서 효과 추가 후 글 흔들림 방지 꿀템 (0) | 2025.05.15 |
---|---|
[NodeJs] 원하는 주소를 넣어 QR코드 만들기 (0) | 2023.08.31 |
[NodeJS] CJS vs ESM | ESM을 사용하고 싶다면? (0) | 2023.08.31 |
[NodeJS] Node Documentation | File system | writeFile | readFile (0) | 2023.08.30 |
[NodeJS] NodeJS의 기본 | version 체크하는 방법 | Node REPL | NodeJS작동법 (0) | 2023.08.30 |