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);
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3930 | 14년 전 | 1352 | ||
| 3929 |
방황하는중년
|
14년 전 | 525 | |
| 3928 | 14년 전 | 642 | ||
| 3927 | 14년 전 | 693 | ||
| 3926 |
Lemios
|
14년 전 | 713 | |
| 3925 | 14년 전 | 994 | ||
| 3924 |
|
14년 전 | 1042 | |
| 3923 | 14년 전 | 1614 | ||
| 3922 | 14년 전 | 638 | ||
| 3921 |
피디인사이드
|
14년 전 | 1081 | |
| 3920 |
wgarlic
|
14년 전 | 2869 | |
| 3919 |
또치2009
|
14년 전 | 794 | |
| 3918 | 14년 전 | 747 | ||
| 3917 |
|
14년 전 | 1182 | |
| 3916 | 14년 전 | 1174 | ||
| 3915 | 14년 전 | 2021 | ||
| 3914 | 14년 전 | 1234 | ||
| 3913 | 14년 전 | 613 | ||
| 3912 | 14년 전 | 551 | ||
| 3911 | 14년 전 | 465 | ||
| 3910 | 14년 전 | 671 | ||
| 3909 | 14년 전 | 2187 | ||
| 3908 | 14년 전 | 624 | ||
| 3907 | 14년 전 | 646 | ||
| 3906 | 14년 전 | 743 | ||
| 3905 | 14년 전 | 946 | ||
| 3904 |
후라보노보노
|
14년 전 | 590 | |
| 3903 | 14년 전 | 871 | ||
| 3902 | 14년 전 | 1430 | ||
| 3901 |
fstjang
|
14년 전 | 666 | |
| 3900 | 14년 전 | 991 | ||
| 3899 |
|
14년 전 | 441 | |
| 3898 | 14년 전 | 505 | ||
| 3897 | 14년 전 | 985 | ||
| 3896 | 14년 전 | 1336 | ||
| 3895 | 14년 전 | 1419 | ||
| 3894 | 14년 전 | 889 | ||
| 3893 | 14년 전 | 812 | ||
| 3892 |
|
14년 전 | 1336 | |
| 3891 | 14년 전 | 858 | ||
| 3890 | 14년 전 | 3953 | ||
| 3889 | 14년 전 | 1887 | ||
| 3888 | 14년 전 | 682 | ||
| 3887 | 14년 전 | 603 | ||
| 3886 | 14년 전 | 3543 | ||
| 3885 |
후라보노보노
|
14년 전 | 4245 | |
| 3884 | 14년 전 | 982 | ||
| 3883 | 14년 전 | 1163 | ||
| 3882 | 14년 전 | 4402 | ||
| 3881 |
minini
|
14년 전 | 1221 | |
| 3880 | 14년 전 | 998 | ||
| 3879 | 14년 전 | 748 | ||
| 3878 | 14년 전 | 764 | ||
| 3877 |
내꿈은대통령
|
14년 전 | 954 | |
| 3876 | 14년 전 | 882 | ||
| 3875 | 14년 전 | 1031 | ||
| 3874 | 14년 전 | 910 | ||
| 3873 | 14년 전 | 1331 | ||
| 3872 |
뜨드미지근
|
14년 전 | 679 | |
| 3871 |
SW커뮤니케이션
|
14년 전 | 538 | |
| 3870 |
방황하는중년
|
14년 전 | 562 | |
| 3869 | 14년 전 | 711 | ||
| 3868 | 14년 전 | 1174 | ||
| 3867 |
방황하는중년
|
14년 전 | 816 | |
| 3866 |
웹스커뮤니티
|
14년 전 | 1358 | |
| 3865 | 14년 전 | 1110 | ||
| 3864 |
|
14년 전 | 1084 | |
| 3863 | 14년 전 | 1052 | ||
| 3862 |
|
14년 전 | 1920 | |
| 3861 |
|
14년 전 | 3238 | |
| 3860 | 14년 전 | 1448 | ||
| 3859 | 14년 전 | 2387 | ||
| 3858 |
웹스커뮤니티
|
14년 전 | 1893 | |
| 3857 | 14년 전 | 1773 | ||
| 3856 |
크라잉감튀
|
14년 전 | 954 | |
| 3855 |
techer
|
14년 전 | 493 | |
| 3854 |
techer
|
14년 전 | 778 | |
| 3853 |
techer
|
14년 전 | 936 | |
| 3852 |
디자이너몽
|
14년 전 | 1653 | |
| 3851 | 14년 전 | 1710 | ||
| 3850 | 14년 전 | 1138 | ||
| 3849 | 14년 전 | 784 | ||
| 3848 | 14년 전 | 1005 | ||
| 3847 | 14년 전 | 1035 | ||
| 3846 | 14년 전 | 1051 | ||
| 3845 | 14년 전 | 584 | ||
| 3844 |
풍객리무진짱
|
14년 전 | 657 | |
| 3843 | 14년 전 | 772 | ||
| 3842 | 14년 전 | 1720 | ||
| 3841 | 14년 전 | 918 | ||
| 3840 | 14년 전 | 862 | ||
| 3839 | 14년 전 | 1151 | ||
| 3838 |
xkingcode
|
14년 전 | 763 | |
| 3837 | 14년 전 | 914 | ||
| 3836 | 14년 전 | 868 | ||
| 3835 |
temptiger
|
14년 전 | 1149 | |
| 3834 | 14년 전 | 699 | ||
| 3833 | 14년 전 | 706 | ||
| 3832 | 14년 전 | 617 | ||
| 3831 | 14년 전 | 726 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기