Showing
3 changed files
with
75 additions
and
0 deletions
OperatingTest/form.html
0 → 100644
OperatingTest/frame.html
0 → 100644
| 1 | +<!doctype html> <!--이 웹페이지가 html로 만들어졌다는 태그--> | ||
| 2 | +<html> <!--head와 body를 감싸는 태그--> | ||
| 3 | +<head> <!--본문을 설명하는 태그--> | ||
| 4 | + <title>webpage frame</title> | ||
| 5 | + <meta charset="utf-8"> | ||
| 6 | +</head> | ||
| 7 | + | ||
| 8 | +<body> <!--본문에 해당하는 태그--> | ||
| 9 | + <h1> webpage frame</h1> | ||
| 10 | + | ||
| 11 | + <ul> | ||
| 12 | + <li>목차1</li> | ||
| 13 | + <li>목차2</li> | ||
| 14 | + <li>목차3</li> | ||
| 15 | + </ul> | ||
| 16 | + | ||
| 17 | + <p>내용 1</p> | ||
| 18 | + <p>내용 2</p> | ||
| 19 | + <!-- target: 새 탭을 여는것--> | ||
| 20 | + <p><a href = "https://www.google.com/webhp?hl=ko&sa=X&ved=0ahUKEwjzxPrzkOrwAhWsF6YKHTq_CFwQPAgI" target = "_blank" title = "하이퍼링크 설명"> Go to google</a></p> | ||
| 21 | + <input type="button" value="BUTTON" onclick="alert('alert box')"> | ||
| 22 | + <input type="text" onchange="alert('changed')"> | ||
| 23 | + <br> | ||
| 24 | + <br> | ||
| 25 | + <script> | ||
| 26 | + document.write(1+2+3); | ||
| 27 | + </script> | ||
| 28 | +</body> | ||
| 29 | +</html> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
OperatingTest/server.txt
0 → 100644
| 1 | +// aws 인스턴스 - chatbot /home/ubuntu/server/server.js 파일임. | ||
| 2 | + | ||
| 3 | +var http = require('http'); | ||
| 4 | +var fs = require('fs'); | ||
| 5 | +var url = require('url'); | ||
| 6 | +var qs = require('querystring'); | ||
| 7 | + | ||
| 8 | +var app = http.createServer(function(request,response){ | ||
| 9 | + | ||
| 10 | + var _url = request.url; | ||
| 11 | + | ||
| 12 | + if (_url === '/'){ | ||
| 13 | + console.log("url is '/'"); | ||
| 14 | + response.writeHead(200); | ||
| 15 | + } else if (_url === '/server'){ | ||
| 16 | + console.log(_url); | ||
| 17 | + var body = ''; | ||
| 18 | + // post로 전달된 데이터를 담을 변수를 선언 | ||
| 19 | + request.on('data', function(data){ | ||
| 20 | + // request객체에 on( ) 함수로 'data' 이벤트를 연결 | ||
| 21 | + body = body + data; | ||
| 22 | + //data 이벤트가 발생할 때마다 callback을 통해 body 변수에 값을 저장 | ||
| 23 | + }); | ||
| 24 | + request.on('end', function(){ | ||
| 25 | + // request객체에 on( ) 함수로 'end' 이벤트를 연결 | ||
| 26 | + var post = qs.parse(body); | ||
| 27 | + // end 이벤트가 발생하면(end는 한번만 발생한다) 3번에서 저장해둔 body 를 querystring 으로 객체화 | ||
| 28 | + console.log(post); | ||
| 29 | + // 객체화된 데이터를 로그로 출력 | ||
| 30 | + response.writeHead(200, {'Content-Type':'text/html'}); | ||
| 31 | + response.end('bus Number = ' + post.busNumber); | ||
| 32 | + // HEADER 와 데이터를 담아서 클라이언트에 응답처리 | ||
| 33 | + }); | ||
| 34 | + } else { | ||
| 35 | + response.writeHead(404); | ||
| 36 | + response.end('Not found'); | ||
| 37 | + } | ||
| 38 | +}); | ||
| 39 | + | ||
| 40 | +app.listen(23023); | ||
| 41 | +console.log("Listening on 23023"); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment