공태현

Implement move page function and get-js-file-API

......@@ -15,6 +15,12 @@ app.get('/', (req,res) => {
res.render('main.html')
})
// js 파일 전송.
app.get('/main.js', (req,res) => {
res.sendFile( __dirname + '/views/mainPage/main.js')
})
app.get('/squart', (req,res) => {
app.set('views', __dirname + '/views/squartPage')
res.render('squart.html')
......
......@@ -8,5 +8,10 @@
</head>
<body>
Main Page
<div>
<input type="button" value = "squart start" id = "moveSquart" onclick="moveSquartPage()"/>
</div>
<script type="text/javascript" src="./main.js"></script>
</body>
</html>
\ No newline at end of file
......
function moveSquartPage()
{
location.href = "/squart";
}
const movePage = document.getElementById("moveSquart")
movePage.addEventListener('click', moveSquartPage);
\ No newline at end of file