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);
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 85 | ||
| 8229 | 9년 전 | 79 | ||
| 8228 |
커네드커네드
|
9년 전 | 119 | |
| 8227 | 9년 전 | 136 | ||
| 8226 | 9년 전 | 172 | ||
| 8225 | 9년 전 | 158 | ||
| 8224 | 9년 전 | 152 | ||
| 8223 | 9년 전 | 120 | ||
| 8222 |
|
9년 전 | 199 | |
| 8221 | 9년 전 | 98 | ||
| 8220 | 9년 전 | 114 | ||
| 8219 | 9년 전 | 108 | ||
| 8218 | 9년 전 | 157 | ||
| 8217 |
star3840
|
9년 전 | 118 | |
| 8216 | 9년 전 | 168 | ||
| 8215 | 9년 전 | 125 | ||
| 8214 | 9년 전 | 231 | ||
| 8213 | 9년 전 | 171 | ||
| 8212 | 9년 전 | 87 | ||
| 8211 | 9년 전 | 258 | ||
| 8210 | 9년 전 | 254 | ||
| 8209 | 9년 전 | 344 | ||
| 8208 | 9년 전 | 233 | ||
| 8207 | 9년 전 | 237 | ||
| 8206 |
|
9년 전 | 198 | |
| 8205 | 9년 전 | 176 | ||
| 8204 | 9년 전 | 144 | ||
| 8203 | 9년 전 | 240 | ||
| 8202 | 9년 전 | 152 | ||
| 8201 | 9년 전 | 188 | ||
| 8200 | 9년 전 | 171 | ||
| 8199 | 9년 전 | 227 | ||
| 8198 | 9년 전 | 183 | ||
| 8197 | 9년 전 | 173 | ||
| 8196 | 9년 전 | 562 | ||
| 8195 | 9년 전 | 170 | ||
| 8194 | 9년 전 | 291 | ||
| 8193 | 9년 전 | 165 | ||
| 8192 | 9년 전 | 206 | ||
| 8191 | 9년 전 | 154 | ||
| 8190 | 9년 전 | 143 | ||
| 8189 | 9년 전 | 199 | ||
| 8188 | 9년 전 | 137 | ||
| 8187 | 9년 전 | 154 | ||
| 8186 | 9년 전 | 151 | ||
| 8185 | 9년 전 | 321 | ||
| 8184 | 9년 전 | 114 | ||
| 8183 | 9년 전 | 333 | ||
| 8182 | 9년 전 | 178 | ||
| 8181 | 9년 전 | 139 | ||
| 8180 | 9년 전 | 708 | ||
| 8179 | 9년 전 | 497 | ||
| 8178 | 9년 전 | 317 | ||
| 8177 |
kiplayer
|
9년 전 | 338 | |
| 8176 | 9년 전 | 361 | ||
| 8175 | 9년 전 | 233 | ||
| 8174 | 9년 전 | 257 | ||
| 8173 | 9년 전 | 352 | ||
| 8172 | 9년 전 | 209 | ||
| 8171 | 9년 전 | 190 | ||
| 8170 | 9년 전 | 302 | ||
| 8169 |
커네드커네드
|
9년 전 | 263 | |
| 8168 | 9년 전 | 330 | ||
| 8167 | 9년 전 | 326 | ||
| 8166 | 9년 전 | 245 | ||
| 8165 | 9년 전 | 179 | ||
| 8164 | 9년 전 | 309 | ||
| 8163 | 9년 전 | 294 | ||
| 8162 | 9년 전 | 309 | ||
| 8161 | 9년 전 | 304 | ||
| 8160 |
|
9년 전 | 504 | |
| 8159 | 9년 전 | 435 | ||
| 8158 | 9년 전 | 262 | ||
| 8157 | 9년 전 | 390 | ||
| 8156 | 9년 전 | 281 | ||
| 8155 | 9년 전 | 263 | ||
| 8154 |
00년생용띠
|
9년 전 | 606 | |
| 8153 | 9년 전 | 240 | ||
| 8152 |
|
9년 전 | 418 | |
| 8151 | 9년 전 | 417 | ||
| 8150 | 9년 전 | 514 | ||
| 8149 |
Jangfolk
|
9년 전 | 356 | |
| 8148 | 9년 전 | 180 | ||
| 8147 | 9년 전 | 382 | ||
| 8146 | 9년 전 | 451 | ||
| 8145 | 9년 전 | 396 | ||
| 8144 | 9년 전 | 362 | ||
| 8143 | 9년 전 | 203 | ||
| 8142 | 9년 전 | 432 | ||
| 8141 | 9년 전 | 386 | ||
| 8140 | 9년 전 | 937 | ||
| 8139 | 9년 전 | 268 | ||
| 8138 |
전갈자리남자
|
9년 전 | 394 | |
| 8137 | 9년 전 | 403 | ||
| 8136 | 9년 전 | 755 | ||
| 8135 |
|
9년 전 | 803 | |
| 8134 |
PlayPixel
|
9년 전 | 526 | |
| 8133 |
|
9년 전 | 449 | |
| 8132 | 9년 전 | 461 | ||
| 8131 | 9년 전 | 823 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기