how to render in node js code example

Example 1: render html in node js

render html in node js
-----------------------------
//server.js & index.html keep in same dir
app.use(express.static('./'));

app.get('/', function(req, res) { 
    res.render('index.html');
});

Example 2: how to render different pages in nodes

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> -->
    <link rel="stylesheet" type="text/css" href="/Static/css/spaceGame.css">
    <!-- <link rel="stylesheet" href="css/normalize.css"> -->
    <link href="https://fonts.googleapis.com/css?family=Raleway:300,400" rel="stylesheet">
    <title>{{title}}</title>
</head>
<body>
    {{{body}}}

        <!-- Footer -->
    <script src="https://unpkg.com/vue"></script>
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>

    <script type="text/javascript" src="/Static/script/someTest.js"></script>
</body>
</html>

Tags:

Html Example