예를들어


주소/index.html

주소/2348.png


이런식으로 해당 주소로 들어가면 그 페이지 열리게끔 어떻게 설정하나요?

if로 하나하나 파일시스템 읽는거말고..


자동으로 그냥 주소만치면 그 파일 여는 사이트 어떻게 구현하죠??


찾아보니까 1개1개 다 지정해서 경로 만드는방법밖에 안나오네요..



--------수정----------


const express = require('express');

const app = express();

const port = 3000;


app.get('/', (req, res, next) => {

    res.send('hello world!');

});


app.listen(port, () => {

    console.log(`Server is running at ${port}`);

});


위소스로 서버 만들었는데






아래주소 치면


http://localhost:3000/index.html 


켄낫겟 뜹니다 ㅠㅠ


index.html 내용은

<HTML>

hi hello

</HTML>

입니당.