๋ฐ์ํ
[์ถ์ฒ-Youtube ์ํ์ฝ๋ฉ]
https://www.youtube.com/watch?v=_bh8ztMJIPE&list=PLuHgQVnccGMA9QQX5wqj6ThK7t2tsGxjm&index=15
var http = require('http');
var fs = require('fs');
var url = require('url');
var app = http.createServer(function(request,response){
var _url = request.url;
var queryData = url.parse(_url, true).query;
console.log(queryData.id);
if(_url == '/'){
url = '/index.html';
}
if(_url == '/favicon.ico'){
return response.writeHead(404);
}
response.writeHead(200);
response.end(queryData.id);
});
app.listen(3000);
๋ฐ์ํ
'JavaScript > Node.js' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Node.js-์ํ์ฝ๋ฉ] Node.js์ ํ์ผ ์ฝ๊ธฐ ๊ธฐ๋ฅ (0) | 2021.01.26 |
---|---|
[Node.js-์ํ์ฝ๋ฉ] App ์ ์ - ๋์ ์ธ ์นํ์ด์ง ๋ง๋ค๊ธฐ (0) | 2021.01.26 |
[Node.js-์ํ์ฝ๋ฉ] URL์ ์ดํด (0) | 2021.01.26 |
[Node.js-์ํ์ฝ๋ฉ] JavaScript ๋ฌธ๋ฒ - Template Literal (0) | 2021.01.25 |
[Node.js-์ํ์ฝ๋ฉ] JavaScript ๋ฌธ๋ฒ - ๋ณ์ (0) | 2021.01.25 |
๋๊ธ