전체 보기

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 const http = require('http'); // http 열기 const express = require('express'); // 익스프레스 열기 const { nextTick } = require('process'); const server = express(); //서버 열기 server.use((req,res,next)=>{ //express 사용할게요 (요청,응답,다음) -- > 로그 hello print ! 작성 console.log('넘겨봐라!'); next(); // 로그 hello print ! 작성 console.log('여기로 넘어와랑'); //
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 32 33 34 35 36 S C:\Users\cas90\Desktop\01-understanding-npm-scripts> // 이걸누름 npm init This utility will walk you through creating a package.json file. It only covers the most common items, and tries to guess sensible defaults. See `npm help init` for definitive documentation on these fields and exactly what they..
익스프레스란 ? 패키지를 쉽게 연결해주기 ! 프레임워크 더나는 코드와 비즈니스 처리를 사용할수있게 해줌 미들웨어? 리퀘스트, 리스폰 라우팅 요청경로 , html 페이지 반환
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 const http = require('http'); const server = http.createServer((req,res) =>{ const url = req.url; if(url==='/'){ // url 값과 / 값이 똑같으면 참이라는뜻 === res.write('') res.write('') // hrml 타이틀과 헤더부분 res.write('') // body 부분에 서버에 나올 내용값 입력 ~ res.write('') return res.end(); } res.write('') res.write('') // hrml 타이틀과 헤더부분 res..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 const http = require('http'); const server = http.createServer((req,res) =>{ console.log(req.url,req.method,req.headers); //process.exit(); res.setHeader('Content-Type','text/html'); // 내용을 text 타입 html 형식으로 보낼게 res.write('') res.write('') // hrml 타이틀과 헤더부분 res.write('hello print') // body 부분에 서버에 나올 내용값 입력 ~ res.write('') res.end(); // 서버에서 >> 클라이언트로 보내는거 여기에..
1 2 3 4 5 6 7 8 9 10 11 const http = require('http'); //http 를 서버 생성하기위해불러옴 const server = http.createServer((req,res) =>{ // 서버를생성 = 서버만듬 console.log(req); // req= requeest 요청이 온걸계속 받기 .!! process.exit(); // 서버 요청 request 중단 하기 위할때 사용 }) server.listen(3000); // node.js 가 들어오는 요청에대해서 계속 데이터 받기 cs 서버 종료를 안하게 되면 위에 빨간 커서가 저렇게 진행됨 process.exit 로 실행하면 요청한것만 다 읽은후 서버 종료 다시 실행되기전값으로 되돌아옴.
조각남자
'분류 전체보기' 카테고리의 글 목록 (48 Page)