-
Notifications
You must be signed in to change notification settings - Fork 458
/
nitro.config.ts
114 lines (113 loc) · 2.85 KB
/
nitro.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import { fileURLToPath } from "node:url";
import { defineNitroConfig } from "../../src/config";
export default defineNitroConfig({
compressPublicAssets: true,
imports: {
presets: [
{
// TODO: move this to built-in preset
from: "scule",
imports: ["camelCase", "pascalCase", "kebabCase"],
},
],
},
handlers: [
{
route: "/api/test/*/foo",
handler: "~/api/hello.ts",
},
],
devProxy: {
"/proxy/example": { target: "https://example.com", changeOrigin: true },
},
alias: {
"#fixture-nitro-utils-extra-absolute": fileURLToPath(
new URL("node_modules/@fixture/nitro-utils/extra2.mjs", import.meta.url)
),
},
serverAssets: [
{
baseName: "files",
dir: "files",
},
],
ignore: [
"api/**/_*",
"middleware/_ignored.ts",
"routes/_*.ts",
"**/_*.txt",
"!**/_unignored.txt",
],
appConfig: {
"nitro-config": true,
dynamic: "initial",
},
runtimeConfig: {
dynamic: "initial",
url: "https://{{APP_DOMAIN}}",
},
appConfigFiles: ["~/server.config.ts"],
publicAssets: [
{
baseURL: "build",
dir: "public/build",
maxAge: 3600,
},
],
tasks: {
"db:migrate": { description: "Migrate database" },
"db:seed": { description: "Seed database" },
},
routeRules: {
"/api/param/prerender4": { prerender: true },
"/api/param/prerender2": { prerender: false },
"/rules/headers": { headers: { "cache-control": "s-maxage=60" } },
"/rules/cors": {
cors: true,
headers: { "access-control-allow-methods": "GET" },
},
"/rules/dynamic": { cache: false, isr: false },
"/rules/redirect": { redirect: "/base" },
"/rules/isr/**": { isr: true },
"/rules/isr-ttl/**": { isr: 60 },
"/rules/swr/**": { swr: true },
"/rules/swr-ttl/**": { swr: 60 },
"/rules/redirect/obj": {
redirect: { to: "https://nitro.unjs.io/", statusCode: 308 },
},
"/rules/redirect/wildcard/**": { redirect: "https://nitro.unjs.io/**" },
"/rules/nested/**": { redirect: "/base", headers: { "x-test": "test" } },
"/rules/nested/override": { redirect: { to: "/other" } },
"/rules/_/noncached/cached": { swr: true },
"/rules/_/noncached/**": { swr: false, cache: false, isr: false },
"/rules/_/cached/noncached": { cache: false, swr: false, isr: false },
"/rules/_/cached/**": { swr: true },
"/api/proxy/**": { proxy: "/api/echo" },
},
prerender: {
crawlLinks: true,
ignore: [
// '/api/param/'
],
routes: ["/prerender", "/404"],
},
experimental: {
openAPI: true,
asyncContext: true,
wasm: true,
envExpansion: true,
database: true,
tasks: true,
},
scheduledTasks: {
"* * * * *": "test",
},
cloudflare: {
pages: {
routes: {
include: ["/*"],
exclude: ["/blog/static/*"],
},
},
},
});