cmd nodejs 질문드립니다.

조회수 380회

과제를 받아서 하고 있는데 도저히 안되서 질문드립니다. 과제 순서가 cmd > node 6-4-1get으로 id칸과 submit창 나오게하기 > submit 누르면 display.html 창이 뜨게하기

6-4-1.js은 method "get" 6-4-2.js post

cmd > d: > cd nodejs > node 6-4-1.js > 마이크로소프트엣지 127.0.0.1:52273 > 6get.html 뜨게하고 > submit 누르면 > display.html 화면으로 전환인데

파일에 있는 6get.html로 들어가면 display.html 가 제대로 나오는데

cmd로 시작해서 들어가면 127.0.0.1:52273:display.get으로 바뀌고 아무런 변화가 없습니다. 도대체 어떻게 해야 고쳐질까요? 6-4-1 코드랑 // 6.get 코드중 어딜 어떻게 고쳐야 할까요?

6-4-1.js 코드------------------------------------------------------------

const fs=require('fs');

const http=require('http');

const url=require('url');

const server=http.createServer((request, response) => {

    if(request.method == 'GET') {
        fs.readFile('6get.html', (error, data)=> {
            response.writeHead(200, {
                'Content-Type': 'text/html'
            });;
            response.end(data);
        });
    }
    else {
        response.writeHead(404);
        response.end();
    }
}).listen(52273, ()=> {

    console.log('http server on.....52273');
});

6.get 코드------------------------------------------------------------------------------------------------------------------------

<.!DOCTYPE html>

<.html>

<.head>
  <.title> login_get.html <./title>
<./head>

<.body>
  <.h1>login_get.html and login_post.html<./h1>

  <.form method = "get">

    <table>
      <tr>
        <td><label>id</label><td>
        <.td><input type="text" name="data_a" /><td>
      </tr>
    </table>
    <button type="button" value="move" class="navyBtn" onClick="location.href='display.html'">
**button 대신 input type= "submit /" 으로 할 시의 방법으로 알고 싶은데 도저히 못찾아서...**
  <./form>
<./body>
</html> 

display.html 코드 ------------------------------------------------------------------------------------------------

이미지랑 텍스트 mp3 mp4 나오게하는 코드

<!DOCTYPE html>
<html>
<head><title>파일명 display.html</title>
</head>
<body>
<h1>멀티 미디어 테스트 페이지 입니다. (text 출력)</h1>
<img src="test.jpg">
</img>
<audio src="a.mp3" autoplay controls>
</audio>
<video src="week6.mp4" controls>
</video>
</body>
</html>

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)