Serve static files
@ServerSettings
let you to configure a list of static folders.
Installation
Install the serve-static
module:
npm install --save serve-static @tsed/servestatic
1
Then configure your server:
import {ServerLoader, ServerSettings} from "@tsed/common";
import "@tsed/servestatic";
import Path = require("path");
const rootDir = Path.resolve(__dirname)
@ServerSettings({
rootDir,
serveStatic: {
"/": `${rootDir}/webapp`
}
})
export class Server extends ServerLoader {
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
TIP
serveStatic attributes supports multiple directories
← Multer Templating →