http://domain/index.php?id=zz3&a=5&b=2
이렇게 있을때.... 주소 끝 변수의 값을 각각 사용하기 위한 방법입니다.
// 기본 셋팅
PORT = "40000";
HOST = null;
// 환경로드
var sys = require('util'),
http = require('http'),
fs = require('fs'),
url = require('url');
// 시작 알림 로그 출력
console.log('Server running');
// html 로드
fs.readFile('index.html', function (err, data) {
if (err) {
throw err;
}
index = data;
});
// 출력
http.createServer(function(request, response) {
response.writeHeader(200, {"Content-Type": "text/html"});
response.write(index); // html 로드 출력
var html = ""; // 기본값 null 지정
// url 파싱 // 참고: http://japhr.blogspot.com/2010/09/url-parsing-in-nodejs-020021.html
var url_parts = url.parse(request.url, true); // url 파싱
var query = url_parts.query; // 쿼티로드 (ex> { id: 'zz3', a: '1', b: '2' } )
html += "id = " + query.id + "<br>"; // html 출력
html += "a = " + query.a + "<br>"; // html 출력
html += "b = " + query.b + "<br>"; // html 출력
console.log(query); //전체 로그 출력
//테스트
// 테스트끝
response.write(html);
response.end(); //close였으나... 다운현상 때문에 end로 변경
}).listen(PORT);
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7530 | 10년 전 | 830 | ||
| 7529 |
파랑새1597
|
10년 전 | 1255 | |
| 7528 |
파랑새1597
|
10년 전 | 1342 | |
| 7527 |
integrity7
|
10년 전 | 1428 | |
| 7526 | 10년 전 | 2450 | ||
| 7525 |
다빈치코드777
|
10년 전 | 1133 | |
| 7524 | 10년 전 | 1598 | ||
| 7523 | 10년 전 | 987 | ||
| 7522 |
|
10년 전 | 1015 | |
| 7521 |
blackkil
|
10년 전 | 1902 | |
| 7520 | 10년 전 | 1321 | ||
| 7519 |
Gaumi
|
10년 전 | 1100 | |
| 7518 | 10년 전 | 1509 | ||
| 7517 | 10년 전 | 848 | ||
| 7516 | 10년 전 | 1323 | ||
| 7515 | 10년 전 | 1436 | ||
| 7514 |
|
10년 전 | 4503 | |
| 7513 |
멋진남자임
|
10년 전 | 1143 | |
| 7512 |
다빈치코드777
|
10년 전 | 904 | |
| 7511 |
|
10년 전 | 3421 | |
| 7510 | 10년 전 | 1388 | ||
| 7509 | 10년 전 | 1167 | ||
| 7508 | 10년 전 | 734 | ||
| 7507 |
senseme
|
10년 전 | 777 | |
| 7506 |
멋진남자임
|
10년 전 | 1672 | |
| 7505 | 10년 전 | 4055 | ||
| 7504 | 10년 전 | 2178 | ||
| 7503 | 10년 전 | 1015 | ||
| 7502 | 10년 전 | 536 | ||
| 7501 | 10년 전 | 1465 | ||
| 7500 | 10년 전 | 1514 | ||
| 7499 | 10년 전 | 3429 | ||
| 7498 | 10년 전 | 1269 | ||
| 7497 |
dethos79
|
10년 전 | 2997 | |
| 7496 | 10년 전 | 2215 | ||
| 7495 | 10년 전 | 937 | ||
| 7494 |
CHAVO
|
10년 전 | 1177 | |
| 7493 | 10년 전 | 2682 | ||
| 7492 | 10년 전 | 1310 | ||
| 7491 | 10년 전 | 1525 | ||
| 7490 | 10년 전 | 2373 | ||
| 7489 | 10년 전 | 2138 | ||
| 7488 |
toptopon
|
10년 전 | 921 | |
| 7487 |
|
10년 전 | 1064 | |
| 7486 | 10년 전 | 3382 | ||
| 7485 | 10년 전 | 1336 | ||
| 7484 | 10년 전 | 1390 | ||
| 7483 | 10년 전 | 1047 | ||
| 7482 | 10년 전 | 684 | ||
| 7481 | 10년 전 | 874 | ||
| 7480 | 10년 전 | 1256 | ||
| 7479 | 10년 전 | 2630 | ||
| 7478 | 10년 전 | 1192 | ||
| 7477 |
멋진남자임
|
10년 전 | 1538 | |
| 7476 |
zeppeto
|
10년 전 | 1152 | |
| 7475 |
200점아빠
|
10년 전 | 936 | |
| 7474 | 10년 전 | 4025 | ||
| 7473 | 10년 전 | 1015 | ||
| 7472 |
나르시스1
|
10년 전 | 1265 | |
| 7471 | 10년 전 | 894 | ||
| 7470 | 10년 전 | 1313 | ||
| 7469 |
플라이SINJI
|
10년 전 | 1023 | |
| 7468 |
|
10년 전 | 584 | |
| 7467 |
|
10년 전 | 708 | |
| 7466 | 10년 전 | 1155 | ||
| 7465 | 10년 전 | 1207 | ||
| 7464 |
|
10년 전 | 1221 | |
| 7463 | 11년 전 | 1283 | ||
| 7462 |
진짜별사탕
|
11년 전 | 882 | |
| 7461 | 11년 전 | 969 | ||
| 7460 | 11년 전 | 3770 | ||
| 7459 |
멋진남자임
|
11년 전 | 1580 | |
| 7458 |
멋진남자임
|
11년 전 | 510 | |
| 7457 | 11년 전 | 941 | ||
| 7456 | 11년 전 | 790 | ||
| 7455 | 11년 전 | 2198 | ||
| 7454 | 11년 전 | 648 | ||
| 7453 | 11년 전 | 859 | ||
| 7452 |
중국어사이트제작
|
11년 전 | 527 | |
| 7451 | 11년 전 | 930 | ||
| 7450 | 11년 전 | 653 | ||
| 7449 |
울라라라우
|
11년 전 | 971 | |
| 7448 | 11년 전 | 1645 | ||
| 7447 |
멋진남자임
|
11년 전 | 530 | |
| 7446 | 11년 전 | 580 | ||
| 7445 |
네이비칼라
|
11년 전 | 1714 | |
| 7444 |
senseme
|
11년 전 | 1432 | |
| 7443 | 11년 전 | 1361 | ||
| 7442 | 11년 전 | 752 | ||
| 7441 |
멋진남자임
|
11년 전 | 1464 | |
| 7440 | 11년 전 | 935 | ||
| 7439 |
|
11년 전 | 790 | |
| 7438 |
|
11년 전 | 961 | |
| 7437 |
basement
|
11년 전 | 1057 | |
| 7436 |
잘살아보자
|
11년 전 | 1154 | |
| 7435 | 11년 전 | 1113 | ||
| 7434 | 11년 전 | 3809 | ||
| 7433 |
|
11년 전 | 2781 | |
| 7432 |
alexkim
|
11년 전 | 886 | |
| 7431 |
이웃집초보
|
11년 전 | 1335 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기