• specufy in the second argument
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Index - lalala</title>
</head>
<body>
This is index page - lalala
</body>
</html>

var express = require('express');
var serveStatic =  require('serve-static');
var app = express().use(  serveStatic(__dirname + '/public', {'index': ['lalala.html']})  ).listen(3000);

$curl http://localhost:3000
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Index - lalala</title>
</head>
<body>
This is index page - lalala
</body>
</html>

What to read next

Previous / Next
Previous: express.js - serveStatic - index 檔案 Next: express.js - express.static - index 檔案
More like this
Subscribe via RSS: Macro · Tech