• 회원가입
  • 로그인
  • 구글아이디로 로그인

[module] Node.js - url 모듈 - URL 문자열 구문 분석.

1,181  

목차

  1. url 모듈 예제 - URL 문자열 구문 분석
  2. url 모듈 정의
  3. url 모듈 구문
  4. url 모듈 메서드

 

url 모듈 예제 - URL 문자열 구문 분석

※ URL 문자열을 URL 객체로 구문 분석하고 href 속성을 추출.

 

var http = require('http');

var url = require('url');

http.createServer(function (req, res) {

    res.writeHead(200, {'Content-Type': 'text/plain'});

    var q = url.parse(req.url, true);

    res.write(q.href);

    res.end();

}).listen(8080);


 

url 모듈 정의

 

URL 문자열을 구문 분석.

 

 

url 모듈 구문

 

var url = require('url');

 

 

url 모듈 메서드

 

url.format()

형식화 된 URL 문자열을 반환.

 

url.parse()

URL 객체를 반환. 예제 보기

 

url.resolve()

URL 확인

 



분류 제목
basic Node.js - Home
basic Node.js - Intro (소개)
basic Node.js - Start (시작) - 사용 환경 구축
basic Node.js - Modules (모듈)
basic Node.js - HTTP Module (데이터 전송 모듈)
basic Node.js - File System Module (파일 시스템 모듈)
basic Node.js - URL Module (주소 처리 모듈)
basic Node.js - NPM (노드 패키지 관리자)
basic Node.js - Events (이벤트)
basic Node.js - Upload Files (파일 업로드) 2
basic Node.js - Email (이메일 보내기)
mysql Node.js - MySQL 설치・연결 + 쿼리 보내기
mysql Node.js - MySQL Create Database (DB 생성)
mysql Node.js - MySQL Create Table (테이블 생성) ※ Primary key 설정.
mysql Node.js - MySQL Insert Into (데이터 삽입)
mysql Node.js - MySQL Select From (데이터 선택)
mysql Node.js - MySQL Where (조건절)
mysql Node.js - MySQL Order By (정렬 순서)
mysql Node.js - MySQL Delete From (데이터 삭제)
mysql Node.js - MySQL Drop Table (테이블 삭제)
1/4
목록
찾아주셔서 감사합니다. Since 2012