nitro 3.0.1-alpha.2 → 3.0.260415-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +2 -2
  3. package/dist/THIRD-PARTY-LICENSES.md +1646 -0
  4. package/dist/_build/common.mjs +7261 -3812
  5. package/dist/_build/rolldown.mjs +32 -42
  6. package/dist/_build/rollup.mjs +28 -48
  7. package/dist/_build/vite.build.mjs +10 -10
  8. package/dist/_chunks/nitro.mjs +102 -327
  9. package/dist/_chunks/nitro2.mjs +8 -9
  10. package/dist/_chunks/nitro3.mjs +136 -0
  11. package/dist/_chunks/nitro4.mjs +127 -0
  12. package/dist/_chunks/utils.mjs +40 -29
  13. package/dist/_common.mjs +13 -25
  14. package/dist/_dev.d.mts +0 -3
  15. package/dist/{_chunks/dev.mjs → _dev.mjs} +132 -330
  16. package/dist/_libs/_.mjs +2 -0
  17. package/dist/_libs/_2.mjs +2 -0
  18. package/dist/_libs/_3.mjs +2 -0
  19. package/dist/_libs/_4.mjs +2 -0
  20. package/dist/_libs/_5.mjs +2 -0
  21. package/dist/_libs/_6.mjs +2 -0
  22. package/dist/_libs/_7.mjs +2 -0
  23. package/dist/_libs/c12+rc9.mjs +814 -0
  24. package/dist/_libs/{c12+giget+readdirp+chokidar.d.mts → c12+readdirp+chokidar.d.mts} +49 -40
  25. package/dist/_libs/citty.mjs +142 -41
  26. package/dist/_libs/commondir+is-reference.mjs +60 -56
  27. package/dist/_libs/compatx.d.mts +0 -2
  28. package/dist/_libs/compatx.mjs +1 -4
  29. package/dist/_libs/esbuild.d.mts +0 -1
  30. package/dist/_libs/escape-string-regexp.mjs +1 -4
  31. package/dist/_libs/{pluginutils+plugin-commonjs.d.mts → estree+pluginutils.d.mts} +0 -5
  32. package/dist/_libs/estree-walker.mjs +4 -92
  33. package/dist/_libs/exsolve.d.mts +1 -0
  34. package/dist/_libs/hasown+resolve+deepmerge.mjs +160 -246
  35. package/dist/_libs/httpxy.d.mts +20 -13
  36. package/dist/_libs/httpxy.mjs +519 -95
  37. package/dist/_libs/js-tokens.d.mts +1 -0
  38. package/dist/_libs/klona.mjs +1 -4
  39. package/dist/_libs/magic-string.d.mts +0 -2
  40. package/dist/_libs/mlly.d.mts +0 -2
  41. package/dist/_libs/nypm+tinyexec.mjs +822 -0
  42. package/dist/_libs/perfect-debounce.mjs +68 -0
  43. package/dist/_libs/pkg-types.d.mts +0 -3
  44. package/dist/_libs/plugin-alias.mjs +1 -5
  45. package/dist/_libs/plugin-inject.mjs +1 -7
  46. package/dist/_libs/plugin-json.mjs +1 -5
  47. package/dist/_libs/pluginutils.mjs +3 -35
  48. package/dist/_libs/readdirp+chokidar.mjs +187 -365
  49. package/dist/_libs/remapping.mjs +1 -5
  50. package/dist/_libs/resolve-uri+gen-mapping.mjs +15 -53
  51. package/dist/_libs/rou3.d.mts +1 -4
  52. package/dist/_libs/rou3.mjs +223 -78
  53. package/dist/_libs/std-env.d.mts +8 -2
  54. package/dist/_libs/strip-literal.d.mts +1 -0
  55. package/dist/_libs/tsconfck.mjs +21 -334
  56. package/dist/_libs/ultrahtml.mjs +3 -16
  57. package/dist/_libs/unimport+unplugin.mjs +244 -388
  58. package/dist/_libs/unplugin+unimport.d.mts +5 -15
  59. package/dist/_libs/unwasm.d.mts +0 -3
  60. package/dist/_presets.mjs +576 -488
  61. package/dist/builder.d.mts +5 -25
  62. package/dist/builder.mjs +3 -8
  63. package/dist/cli/_chunks/build.mjs +22 -25
  64. package/dist/cli/_chunks/common.mjs +1 -4
  65. package/dist/cli/_chunks/deploy.mjs +37 -0
  66. package/dist/cli/_chunks/dev.mjs +6 -11
  67. package/dist/cli/_chunks/docs.mjs +28 -0
  68. package/dist/cli/_chunks/list.mjs +4 -8
  69. package/dist/cli/_chunks/prepare.mjs +2 -6
  70. package/dist/cli/_chunks/preview.mjs +48 -0
  71. package/dist/cli/_chunks/run.mjs +7 -11
  72. package/dist/cli/_chunks/task.mjs +1 -5
  73. package/dist/cli/index.mjs +5 -6
  74. package/dist/docs/0.docs/0.index/index.md +56 -0
  75. package/dist/docs/0.docs/1.quick-start.md +110 -0
  76. package/dist/docs/0.docs/10.lifecycle.md +204 -0
  77. package/dist/docs/0.docs/11.openapi.md +291 -0
  78. package/dist/docs/0.docs/12.plugins.md +164 -0
  79. package/dist/docs/0.docs/13.tasks.md +277 -0
  80. package/dist/docs/0.docs/14.websocket.md +386 -0
  81. package/dist/docs/0.docs/15.migration.md +213 -0
  82. package/dist/docs/0.docs/16.nightly.md +31 -0
  83. package/dist/docs/0.docs/2.renderer.md +322 -0
  84. package/dist/docs/0.docs/3.routing.md +711 -0
  85. package/dist/docs/0.docs/4.server-entry.md +239 -0
  86. package/dist/docs/0.docs/5.cache.md +408 -0
  87. package/dist/docs/0.docs/6.storage.md +261 -0
  88. package/dist/docs/0.docs/7.assets.md +166 -0
  89. package/dist/docs/0.docs/8.configuration.md +256 -0
  90. package/dist/docs/0.docs/9.database.md +185 -0
  91. package/dist/docs/1.deploy/0.index/index.md +64 -0
  92. package/dist/docs/1.deploy/1.runtimes/0.node.md +63 -0
  93. package/dist/docs/1.deploy/1.runtimes/1.bun.md +15 -0
  94. package/dist/docs/1.deploy/1.runtimes/2.deno.md +19 -0
  95. package/dist/docs/1.deploy/2.providers/0.alwaysdata.md +50 -0
  96. package/dist/docs/1.deploy/2.providers/1.aws.md +47 -0
  97. package/dist/docs/1.deploy/2.providers/10.flightcontrol.md +67 -0
  98. package/dist/docs/1.deploy/2.providers/11.genezio.md +67 -0
  99. package/dist/docs/1.deploy/2.providers/12.github-pages.md +68 -0
  100. package/dist/docs/1.deploy/2.providers/13.gitlab-pages.md +37 -0
  101. package/dist/docs/1.deploy/2.providers/14.heroku.md +84 -0
  102. package/dist/docs/1.deploy/2.providers/15.iis.md +38 -0
  103. package/dist/docs/1.deploy/2.providers/16.koyeb.md +109 -0
  104. package/dist/docs/1.deploy/2.providers/17.netlify.md +47 -0
  105. package/dist/docs/1.deploy/2.providers/18.platform-sh.md +37 -0
  106. package/dist/docs/1.deploy/2.providers/19.render.md +37 -0
  107. package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +81 -0
  108. package/dist/docs/1.deploy/2.providers/20.stormkit.md +24 -0
  109. package/dist/docs/1.deploy/2.providers/21.vercel.md +270 -0
  110. package/dist/docs/1.deploy/2.providers/22.zeabur.md +19 -0
  111. package/dist/docs/1.deploy/2.providers/23.zephyr.md +99 -0
  112. package/dist/docs/1.deploy/2.providers/24.zerops.md +102 -0
  113. package/dist/docs/1.deploy/2.providers/3.azure.md +72 -0
  114. package/dist/docs/1.deploy/2.providers/4.cleavr.md +33 -0
  115. package/dist/docs/1.deploy/2.providers/5.cloudflare.md +369 -0
  116. package/dist/docs/1.deploy/2.providers/6.deno-deploy.md +66 -0
  117. package/dist/docs/1.deploy/2.providers/7.digitalocean.md +46 -0
  118. package/dist/docs/1.deploy/2.providers/8.edgeone.md +20 -0
  119. package/dist/docs/1.deploy/2.providers/9.firebase.md +32 -0
  120. package/dist/docs/2.config/0.index/index.md +1221 -0
  121. package/dist/docs/3.examples/0.index/index.md +3 -0
  122. package/dist/docs/3.examples/1.api-routes.md +145 -0
  123. package/dist/docs/3.examples/10.hono.md +74 -0
  124. package/dist/docs/3.examples/11.import-alias.md +97 -0
  125. package/dist/docs/3.examples/12.middleware.md +91 -0
  126. package/dist/docs/3.examples/13.mono-jsx.md +68 -0
  127. package/dist/docs/3.examples/14.nano-jsx.md +70 -0
  128. package/dist/docs/3.examples/15.plugins.md +91 -0
  129. package/dist/docs/3.examples/16.renderer.md +113 -0
  130. package/dist/docs/3.examples/17.runtime-config.md +97 -0
  131. package/dist/docs/3.examples/18.server-fetch.md +87 -0
  132. package/dist/docs/3.examples/19.shiki.md +198 -0
  133. package/dist/docs/3.examples/2.auto-imports.md +92 -0
  134. package/dist/docs/3.examples/20.virtual-routes.md +74 -0
  135. package/dist/docs/3.examples/21.vite-nitro-plugin.md +79 -0
  136. package/dist/docs/3.examples/22.vite-rsc.md +1041 -0
  137. package/dist/docs/3.examples/23.vite-ssr-html.md +217 -0
  138. package/dist/docs/3.examples/24.vite-ssr-preact.md +247 -0
  139. package/dist/docs/3.examples/25.vite-ssr-react.md +226 -0
  140. package/dist/docs/3.examples/26.vite-ssr-solid.md +256 -0
  141. package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +442 -0
  142. package/dist/docs/3.examples/28.vite-ssr-tss-react.md +444 -0
  143. package/dist/docs/3.examples/29.vite-ssr-vue-router.md +617 -0
  144. package/dist/docs/3.examples/3.cached-handler.md +81 -0
  145. package/dist/docs/3.examples/30.vite-trpc.md +335 -0
  146. package/dist/docs/3.examples/31.websocket.md +282 -0
  147. package/dist/docs/3.examples/4.custom-error-handler.md +98 -0
  148. package/dist/docs/3.examples/5.database.md +157 -0
  149. package/dist/docs/3.examples/6.elysia.md +70 -0
  150. package/dist/docs/3.examples/7.express.md +78 -0
  151. package/dist/docs/3.examples/8.fastify.md +79 -0
  152. package/dist/docs/3.examples/9.hello-world.md +68 -0
  153. package/dist/docs/README.md +86 -0
  154. package/dist/docs/index.md +121 -0
  155. package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +8 -0
  156. package/dist/node_modules/@poppinss/dumper/package.json +1 -1
  157. package/dist/node_modules/@speed-highlight/core/dist/index.js +4 -4
  158. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -2
  159. package/dist/node_modules/@speed-highlight/core/package.json +1 -1
  160. package/dist/node_modules/cookie-es/dist/index.mjs +299 -250
  161. package/dist/node_modules/cookie-es/package.json +26 -23
  162. package/dist/node_modules/croner/dist/croner.js +1 -1
  163. package/dist/node_modules/croner/package.json +11 -1
  164. package/dist/node_modules/defu/dist/defu.mjs +2 -2
  165. package/dist/node_modules/defu/package.json +33 -28
  166. package/dist/node_modules/rendu/dist/_chunks/libs/cookie-es.mjs +151 -0
  167. package/dist/node_modules/rendu/dist/index.mjs +5 -112
  168. package/dist/node_modules/rendu/package.json +25 -24
  169. package/dist/node_modules/youch/build/helpers-B9BQYaS6.js +23 -0
  170. package/dist/node_modules/youch/build/index.js +204 -351
  171. package/dist/node_modules/youch/build/public/error_info/script.js +1 -1
  172. package/dist/node_modules/youch/build/public_dir-C5bujZKB.js +25 -0
  173. package/dist/node_modules/youch/build/src/templates/error_cause/main.js +44 -0
  174. package/dist/node_modules/youch/build/src/templates/error_info/main.js +72 -0
  175. package/dist/node_modules/youch/build/src/templates/error_metadata/main.js +65 -0
  176. package/dist/node_modules/youch/build/src/templates/error_stack/main.js +152 -0
  177. package/dist/node_modules/youch/build/src/templates/error_stack_source/main.js +46 -0
  178. package/dist/node_modules/youch/build/src/templates/header/main.js +24 -0
  179. package/dist/node_modules/youch/build/src/templates/layout/main.js +27 -0
  180. package/dist/node_modules/youch/package.json +35 -32
  181. package/dist/presets/_nitro/runtime/nitro-dev.mjs +12 -57
  182. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -0
  183. package/dist/presets/_nitro/runtime/service-worker.mjs +1 -2
  184. package/dist/presets/aws-lambda/runtime/_utils.mjs +6 -6
  185. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +3 -1
  186. package/dist/presets/azure/runtime/_utils.mjs +5 -5
  187. package/dist/presets/azure/runtime/azure-swa.mjs +5 -5
  188. package/dist/presets/bun/runtime/bun.mjs +9 -6
  189. package/dist/presets/cloudflare/runtime/_module-handler.mjs +1 -1
  190. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -4
  191. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +3 -3
  192. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +2 -2
  193. package/dist/presets/cloudflare/runtime/plugin.dev.mjs +10 -21
  194. package/dist/presets/deno/runtime/deno-deploy.mjs +4 -4
  195. package/dist/presets/deno/runtime/deno-server.mjs +9 -6
  196. package/dist/presets/edgeone/runtime/edgeone.mjs +10 -0
  197. package/dist/presets/netlify/runtime/netlify-edge.mjs +2 -3
  198. package/dist/presets/netlify/runtime/netlify.mjs +1 -1
  199. package/dist/presets/node/runtime/node-cluster.mjs +5 -4
  200. package/dist/presets/node/runtime/node-middleware.mjs +1 -1
  201. package/dist/presets/node/runtime/node-server.mjs +8 -5
  202. package/dist/presets/stormkit/runtime/stormkit.mjs +1 -2
  203. package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
  204. package/dist/presets/vercel/runtime/queue-handler.mjs +21 -0
  205. package/dist/presets/vercel/runtime/vercel.node.mjs +3 -3
  206. package/dist/presets/vercel/runtime/vercel.web.mjs +3 -5
  207. package/dist/presets/winterjs/runtime/winterjs.mjs +10 -10
  208. package/dist/presets/zephyr/runtime/server.mjs +3 -0
  209. package/dist/runtime/internal/app.mjs +12 -11
  210. package/dist/runtime/internal/cache.d.mts +0 -4
  211. package/dist/runtime/internal/cache.mjs +32 -256
  212. package/dist/runtime/internal/context.d.mts +3 -1
  213. package/dist/runtime/internal/context.mjs +1 -9
  214. package/dist/runtime/internal/error/dev.d.mts +5 -4
  215. package/dist/runtime/internal/error/dev.mjs +47 -49
  216. package/dist/runtime/internal/error/hooks.d.mts +1 -1
  217. package/dist/runtime/internal/error/prod.d.mts +2 -5
  218. package/dist/runtime/internal/error/prod.mjs +19 -33
  219. package/dist/runtime/internal/error/utils.d.mts +4 -4
  220. package/dist/runtime/internal/meta.d.mts +1 -1
  221. package/dist/runtime/internal/plugin.d.mts +2 -2
  222. package/dist/runtime/internal/route-rules.d.mts +11 -4
  223. package/dist/runtime/internal/route-rules.mjs +15 -5
  224. package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -2
  225. package/dist/runtime/internal/routes/dev-tasks.mjs +15 -10
  226. package/dist/runtime/internal/routes/openapi.mjs +2 -2
  227. package/dist/runtime/internal/routes/renderer-template.d.mts +1 -1
  228. package/dist/runtime/internal/routes/renderer-template.dev.d.mts +2 -1
  229. package/dist/runtime/internal/routes/scalar.mjs +3 -3
  230. package/dist/runtime/internal/routes/swagger.mjs +7 -4
  231. package/dist/runtime/internal/runtime-config.d.mts +1 -1
  232. package/dist/runtime/internal/runtime-config.mjs +2 -2
  233. package/dist/runtime/internal/static.mjs +5 -4
  234. package/dist/runtime/internal/task.d.mts +3 -1
  235. package/dist/runtime/internal/task.mjs +7 -7
  236. package/dist/runtime/internal/vite/dev-entry.mjs +6 -3
  237. package/dist/runtime/internal/vite/dev-worker.mjs +264 -0
  238. package/dist/runtime/meta.d.mts +1 -0
  239. package/dist/runtime/meta.mjs +2 -0
  240. package/dist/runtime/nitro.d.mts +2 -0
  241. package/dist/runtime/nitro.mjs +4 -2
  242. package/dist/runtime/virtual/error-handler.mjs +1 -1
  243. package/dist/runtime/virtual/renderer-template.mjs +1 -1
  244. package/dist/runtime/virtual/server-assets.d.mts +2 -1
  245. package/dist/runtime/virtual/tracing.d.mts +5 -0
  246. package/dist/runtime/virtual/tracing.mjs +1 -0
  247. package/dist/runtime/vite.d.mts +1 -1
  248. package/dist/types/index.d.mts +215 -195
  249. package/dist/types/index.mjs +1 -11
  250. package/dist/vite.d.mts +3 -8
  251. package/dist/vite.mjs +285 -253
  252. package/lib/tsconfig.json +3 -5
  253. package/package.json +97 -80
  254. package/dist/_libs/confbox.mjs +0 -2509
  255. package/dist/_libs/nypm+giget+tinyexec.mjs +0 -3603
  256. package/dist/_libs/rc9+c12+dotenv.mjs +0 -972
  257. package/dist/node_modules/hookable/dist/index.mjs +0 -266
  258. package/dist/node_modules/hookable/package.json +0 -52
  259. package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +0 -42
  260. package/dist/node_modules/youch/build/chunk-7QV3D5YX.js +0 -83
  261. package/dist/node_modules/youch/build/chunk-AUGPHE32.js +0 -39
  262. package/dist/node_modules/youch/build/chunk-CM7DWJNZ.js +0 -44
  263. package/dist/node_modules/youch/build/chunk-EJH674NB.js +0 -223
  264. package/dist/node_modules/youch/build/chunk-OIJ3WD7L.js +0 -81
  265. package/dist/node_modules/youch/build/chunk-P36L72PL.js +0 -87
  266. package/dist/node_modules/youch/build/chunk-PE3GG3TN.js +0 -65
  267. package/dist/node_modules/youch/build/chunk-X53OIOJH.js +0 -70
  268. package/dist/presets/_nitro/runtime/nitro-dev.d.mts +0 -2
  269. package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +0 -3
  270. package/dist/presets/_nitro/runtime/service-worker.d.mts +0 -2
  271. package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +0 -2
  272. package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -8
  273. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +0 -2
  274. package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +0 -3
  275. package/dist/presets/azure/runtime/_utils.d.mts +0 -2
  276. package/dist/presets/azure/runtime/azure-swa.d.mts +0 -5
  277. package/dist/presets/bun/runtime/bun.d.mts +0 -3
  278. package/dist/presets/cloudflare/runtime/_module-handler.d.mts +0 -16
  279. package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +0 -11
  280. package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +0 -3
  281. package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +0 -20
  282. package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +0 -3
  283. package/dist/presets/deno/runtime/deno-deploy.d.mts +0 -5
  284. package/dist/presets/deno/runtime/deno-server.d.mts +0 -3
  285. package/dist/presets/netlify/runtime/netlify-edge.d.mts +0 -3
  286. package/dist/presets/netlify/runtime/netlify.d.mts +0 -4
  287. package/dist/presets/node/runtime/node-cluster.d.mts +0 -3
  288. package/dist/presets/node/runtime/node-middleware.d.mts +0 -3
  289. package/dist/presets/node/runtime/node-server.d.mts +0 -3
  290. package/dist/presets/standard/runtime/server.d.mts +0 -3
  291. package/dist/presets/stormkit/runtime/stormkit.d.mts +0 -21
  292. package/dist/presets/vercel/runtime/isr.d.mts +0 -2
  293. package/dist/presets/vercel/runtime/vercel.node.d.mts +0 -3
  294. package/dist/presets/vercel/runtime/vercel.web.d.mts +0 -8
  295. package/dist/presets/winterjs/runtime/winterjs.d.mts +0 -2
  296. package/dist/presets/zeabur/runtime/zeabur.d.mts +0 -3
  297. package/dist/runtime/internal/vite/node-runner.mjs +0 -359
@@ -1,28 +1,15 @@
1
1
  import { t as NitroDevApp } from "./_dev.mjs";
2
- import { IncomingMessage, OutgoingMessage } from "node:http";
3
- import { Duplex } from "node:stream";
2
+ import { RunnerMessageListener, RunnerRPCHooks } from "env-runner";
3
+ import { IncomingMessage } from "node:http";
4
+ import { Socket } from "node:net";
4
5
  import { Server, ServerOptions } from "srvx";
5
- import { LoadConfigOptions, Nitro, NitroBuildInfo, NitroConfig, NitroOptions, RunnerMessageListener, RunnerRPCHooks, TaskEvent, TaskRunnerOptions } from "nitro/types";
6
-
7
- //#region src/nitro.d.ts
6
+ import { LoadConfigOptions, Nitro, NitroBuildInfo, NitroConfig, NitroOptions, TaskEvent, TaskRunnerOptions } from "nitro/types";
8
7
  declare function createNitro(config?: NitroConfig, opts?: LoadConfigOptions): Promise<Nitro>;
9
- //#endregion
10
- //#region src/config/loader.d.ts
11
8
  declare function loadOptions(configOverrides?: NitroConfig, opts?: LoadConfigOptions): Promise<NitroOptions>;
12
- //#endregion
13
- //#region src/build/build.d.ts
14
9
  declare function build(nitro: Nitro): Promise<void>;
15
- //#endregion
16
- //#region src/build/assets.d.ts
17
10
  declare function copyPublicAssets(nitro: Nitro): Promise<void>;
18
- //#endregion
19
- //#region src/build/prepare.d.ts
20
11
  declare function prepare(nitro: Nitro): Promise<void>;
21
- //#endregion
22
- //#region src/build/types.d.ts
23
12
  declare function writeTypes(nitro: Nitro): Promise<void>;
24
- //#endregion
25
- //#region src/build/info.d.ts
26
13
  declare function getBuildInfo(root: string): Promise<{
27
14
  outputDir?: undefined;
28
15
  buildInfo?: undefined;
@@ -30,13 +17,11 @@ declare function getBuildInfo(root: string): Promise<{
30
17
  outputDir: string;
31
18
  buildInfo?: NitroBuildInfo;
32
19
  }>;
33
- //#endregion
34
- //#region src/dev/server.d.ts
35
20
  declare function createDevServer(nitro: Nitro): NitroDevServer;
36
21
  declare class NitroDevServer extends NitroDevApp implements RunnerRPCHooks {
37
22
  #private;
38
23
  constructor(nitro: Nitro);
39
- upgrade(req: IncomingMessage, socket: OutgoingMessage<IncomingMessage> | Duplex, head: any): Promise<any>;
24
+ upgrade(req: IncomingMessage, socket: Socket, head: any): Promise<void>;
40
25
  listen(opts?: Partial<Omit<ServerOptions, "fetch">>): Server;
41
26
  close(): Promise<void>;
42
27
  reload(): void;
@@ -44,11 +29,7 @@ declare class NitroDevServer extends NitroDevApp implements RunnerRPCHooks {
44
29
  onMessage(listener: RunnerMessageListener): void;
45
30
  offMessage(listener: RunnerMessageListener): void;
46
31
  }
47
- //#endregion
48
- //#region src/prerender/prerender.d.ts
49
32
  declare function prerender(nitro: Nitro): Promise<void>;
50
- //#endregion
51
- //#region src/task.d.ts
52
33
  /** @experimental */
53
34
  declare function runTask(taskEvent: TaskEvent, opts?: TaskRunnerOptions): Promise<{
54
35
  result: unknown;
@@ -59,5 +40,4 @@ declare function listTasks(opts?: TaskRunnerOptions): Promise<Record<string, {
59
40
  description: string;
60
41
  };
61
42
  }>>;
62
- //#endregion
63
43
  export { build, copyPublicAssets, createDevServer, createNitro, getBuildInfo, listTasks, loadOptions, prepare, prerender, runTask, writeTypes };
package/dist/builder.mjs CHANGED
@@ -1,9 +1,4 @@
1
- import "./_common.mjs";
2
- import { D as prepare, M as build, O as copyPublicAssets, _ as writeTypes, m as getBuildInfo } from "./_build/common.mjs";
3
- import "./_libs/rc9+c12+dotenv.mjs";
1
+ import { D as copyPublicAssets, E as prepare, _ as writeTypes, j as build, m as getBuildInfo } from "./_build/common.mjs";
4
2
  import { a as loadOptions, i as createNitro, n as runTask, r as prerender, t as listTasks } from "./_chunks/nitro.mjs";
5
- import "./_libs/tsconfck.mjs";
6
- import "./_chunks/nitro2.mjs";
7
- import { n as createDevServer } from "./_chunks/dev.mjs";
8
-
9
- export { build, copyPublicAssets, createDevServer, createNitro, getBuildInfo, listTasks, loadOptions, prepare, prerender, runTask, writeTypes };
3
+ import { n as createDevServer } from "./_dev.mjs";
4
+ export { build, copyPublicAssets, createDevServer, createNitro, getBuildInfo, listTasks, loadOptions, prepare, prerender, runTask, writeTypes };
@@ -1,33 +1,32 @@
1
- import { ct as resolve } from "../../_build/common.mjs";
1
+ import { dt as resolve } from "../../_build/common.mjs";
2
2
  import { t as defineCommand } from "../../_libs/citty.mjs";
3
3
  import { t as commonArgs } from "./common.mjs";
4
4
  import { build, copyPublicAssets, createNitro, prepare, prerender } from "nitro/builder";
5
-
6
- //#region src/cli/commands/build.ts
5
+ const buildArgs = {
6
+ ...commonArgs,
7
+ minify: {
8
+ type: "boolean",
9
+ description: "Minify the output (overrides preset defaults you can also use `--no-minify` to disable)."
10
+ },
11
+ preset: {
12
+ type: "string",
13
+ description: "The build preset to use (you can also use `NITRO_PRESET` environment variable)."
14
+ },
15
+ builder: {
16
+ type: "string",
17
+ description: "The builder to use (you can also use `NITRO_BUILDER` environment variable)."
18
+ },
19
+ compatibilityDate: {
20
+ type: "string",
21
+ description: "The date to use for preset compatibility (you can also use `NITRO_COMPATIBILITY_DATE` environment variable)."
22
+ }
23
+ };
7
24
  var build_default = defineCommand({
8
25
  meta: {
9
26
  name: "build",
10
27
  description: "Build nitro project for production"
11
28
  },
12
- args: {
13
- ...commonArgs,
14
- minify: {
15
- type: "boolean",
16
- description: "Minify the output (overrides preset defaults you can also use `--no-minify` to disable)."
17
- },
18
- preset: {
19
- type: "string",
20
- description: "The build preset to use (you can also use `NITRO_PRESET` environment variable)."
21
- },
22
- builder: {
23
- type: "string",
24
- description: "The builder to use (you can also use `NITRO_BUILDER` environment variable)."
25
- },
26
- compatibilityDate: {
27
- type: "string",
28
- description: "The date to use for preset compatibility (you can also use `NITRO_COMPATIBILITY_DATE` environment variable)."
29
- }
30
- },
29
+ args: buildArgs,
31
30
  async run({ args }) {
32
31
  const nitro = await createNitro({
33
32
  rootDir: resolve(args.dir || args._dir || "."),
@@ -43,6 +42,4 @@ var build_default = defineCommand({
43
42
  await nitro.close();
44
43
  }
45
44
  });
46
-
47
- //#endregion
48
- export { build_default as default };
45
+ export { buildArgs, build_default as default };
@@ -1,4 +1,3 @@
1
- //#region src/cli/common.ts
2
1
  const commonArgs = {
3
2
  dir: {
4
3
  type: "string",
@@ -10,6 +9,4 @@ const commonArgs = {
10
9
  description: "project root directory (prefer using `--dir`)"
11
10
  }
12
11
  };
13
-
14
- //#endregion
15
- export { commonArgs as t };
12
+ export { commonArgs as t };
@@ -0,0 +1,37 @@
1
+ import { dt as resolve, m as getBuildInfo, ut as relative } from "../../_build/common.mjs";
2
+ import { t as defineCommand } from "../../_libs/citty.mjs";
3
+ import build_default, { buildArgs } from "./build.mjs";
4
+ import consola from "consola";
5
+ import { execSync } from "node:child_process";
6
+ var deploy_default = defineCommand({
7
+ meta: {
8
+ name: "deploy",
9
+ description: "Build and deploy nitro project for production"
10
+ },
11
+ args: {
12
+ ...buildArgs,
13
+ prebuilt: {
14
+ type: "boolean",
15
+ description: "Skip the build step and deploy the existing build"
16
+ }
17
+ },
18
+ async run(ctx) {
19
+ globalThis.__nitroDeploying__ = true;
20
+ if (!ctx.args.prebuilt) await build_default.run(ctx);
21
+ if (globalThis.__nitroDeployed__) return;
22
+ const { buildInfo, outputDir } = await getBuildInfo(resolve(ctx.args.dir || ctx.args._dir || "."));
23
+ if (!buildInfo) {
24
+ consola.error("No build info found, cannot deploy.");
25
+ process.exit(1);
26
+ }
27
+ if (!buildInfo.commands?.deploy) {
28
+ consola.error(`The \`${buildInfo.preset}\` preset does not have a default deploy command.\n\nTry using a different preset with the \`--preset\` option, or configure a deploy command in the Nitro config, or deploy manually.`);
29
+ process.exit(1);
30
+ }
31
+ const extraArgs = ctx.rawArgs.indexOf("--") !== -1 ? ctx.rawArgs.slice(ctx.rawArgs.indexOf("--") + 1).join(" ") : "";
32
+ const deployCommand = buildInfo.commands.deploy.replace(/([\s:])\.\/(\S*)/g, `$1${relative(process.cwd(), outputDir)}/$2`) + (extraArgs ? ` ${extraArgs}` : "");
33
+ consola.info(`$ ${deployCommand}`);
34
+ execSync(deployCommand, { stdio: "inherit" });
35
+ }
36
+ });
37
+ export { deploy_default as default };
@@ -1,12 +1,9 @@
1
- import { ct as resolve } from "../../_build/common.mjs";
2
- import "../../_libs/rc9+c12+dotenv.mjs";
3
- import { t as NitroDevServer } from "../../_chunks/dev.mjs";
1
+ import { dt as resolve } from "../../_build/common.mjs";
2
+ import { t as NitroDevServer } from "../../_dev.mjs";
4
3
  import { t as defineCommand } from "../../_libs/citty.mjs";
5
4
  import { t as commonArgs } from "./common.mjs";
6
- import { consola } from "consola";
5
+ import { consola as consola$1 } from "consola";
7
6
  import { build, createNitro, prepare } from "nitro/builder";
8
-
9
- //#region src/cli/commands/dev.ts
10
7
  const hmrKeyRe = /^runtimeConfig\.|routeRules\./;
11
8
  var dev_default = defineCommand({
12
9
  meta: {
@@ -29,7 +26,7 @@ var dev_default = defineCommand({
29
26
  let nitro;
30
27
  const reload = async () => {
31
28
  if (nitro) {
32
- consola.info("Restarting dev server...");
29
+ consola$1.info("Restarting dev server...");
33
30
  if ("unwatch" in nitro.options._c12) await nitro.options._c12.unwatch();
34
31
  await nitro.close();
35
32
  }
@@ -42,7 +39,7 @@ var dev_default = defineCommand({
42
39
  c12: { async onUpdate({ getDiff, newConfig }) {
43
40
  const diff = getDiff();
44
41
  if (diff.length === 0) return;
45
- consola.info("Nitro config updated:\n" + diff.map((entry) => ` ${entry.toString()}`).join("\n"));
42
+ consola$1.info("Nitro config updated:\n" + diff.map((entry) => ` ${entry.toString()}`).join("\n"));
46
43
  await (diff.every((e) => hmrKeyRe.test(e.key)) ? nitro.updateConfig(newConfig.config || {}) : reload());
47
44
  } }
48
45
  });
@@ -57,6 +54,4 @@ var dev_default = defineCommand({
57
54
  await reload();
58
55
  }
59
56
  });
60
-
61
- //#endregion
62
- export { dev_default as default };
57
+ export { dev_default as default };
@@ -0,0 +1,28 @@
1
+ import { t as defineCommand } from "../../_libs/citty.mjs";
2
+ import { docsDir } from "nitro/meta";
3
+ import { execSync } from "node:child_process";
4
+ var docs_default = defineCommand({
5
+ meta: {
6
+ name: "docs",
7
+ description: "Explore Nitro documentation"
8
+ },
9
+ args: { page: {
10
+ type: "string",
11
+ description: "Page path to open"
12
+ } },
13
+ run({ rawArgs }) {
14
+ const runnerCmd = ([
15
+ ["bun", "x"],
16
+ ["pnpm", "dlx"],
17
+ ["npm", "x"]
18
+ ].find(([pkg]) => {
19
+ try {
20
+ execSync(`${pkg} -v`, { stdio: "ignore" });
21
+ return true;
22
+ } catch {}
23
+ }) || ["npm", "x"]).join(" ");
24
+ const args = rawArgs?.join(" ") || "";
25
+ execSync(`${runnerCmd} mdzilla ${docsDir}${args ? ` ${args}` : ""}`, { stdio: "inherit" });
26
+ }
27
+ });
28
+ export { docs_default as default };
@@ -1,9 +1,7 @@
1
- import { ct as resolve } from "../../_build/common.mjs";
1
+ import { dt as resolve } from "../../_build/common.mjs";
2
2
  import { t as defineCommand } from "../../_libs/citty.mjs";
3
- import { consola } from "consola";
3
+ import { consola as consola$1 } from "consola";
4
4
  import { listTasks, loadOptions } from "nitro/builder";
5
-
6
- //#region src/cli/commands/task/list.ts
7
5
  var list_default = defineCommand({
8
6
  meta: {
9
7
  name: "run",
@@ -19,9 +17,7 @@ var list_default = defineCommand({
19
17
  cwd,
20
18
  buildDir: (await loadOptions({ rootDir: cwd }).catch(() => void 0))?.buildDir || ".nitro"
21
19
  });
22
- for (const [name, task] of Object.entries(tasks)) consola.log(` - \`${name}\`${task.meta?.description ? ` - ${task.meta.description}` : ""}`);
20
+ for (const [name, task] of Object.entries(tasks)) consola$1.log(` - \`${name}\`${task.meta?.description ? ` - ${task.meta.description}` : ""}`);
23
21
  }
24
22
  });
25
-
26
- //#endregion
27
- export { list_default as default };
23
+ export { list_default as default };
@@ -1,9 +1,7 @@
1
- import { ct as resolve } from "../../_build/common.mjs";
1
+ import { dt as resolve } from "../../_build/common.mjs";
2
2
  import { t as defineCommand } from "../../_libs/citty.mjs";
3
3
  import { t as commonArgs } from "./common.mjs";
4
4
  import { createNitro, writeTypes } from "nitro/builder";
5
-
6
- //#region src/cli/commands/prepare.ts
7
5
  var prepare_default = defineCommand({
8
6
  meta: {
9
7
  name: "prepare",
@@ -14,6 +12,4 @@ var prepare_default = defineCommand({
14
12
  await writeTypes(await createNitro({ rootDir: resolve(args.dir || args._dir || ".") }));
15
13
  }
16
14
  });
17
-
18
- //#endregion
19
- export { prepare_default as default };
15
+ export { prepare_default as default };
@@ -0,0 +1,48 @@
1
+ import { dt as resolve } from "../../_build/common.mjs";
2
+ import { t as defineCommand } from "../../_libs/citty.mjs";
3
+ import { t as startPreview } from "../../_chunks/nitro4.mjs";
4
+ import { t as commonArgs } from "./common.mjs";
5
+ import { serve } from "srvx";
6
+ import { log } from "srvx/log";
7
+ var preview_default = defineCommand({
8
+ meta: {
9
+ name: "preview",
10
+ description: "Start a local server to preview the built server"
11
+ },
12
+ args: {
13
+ ...commonArgs,
14
+ port: {
15
+ type: "string",
16
+ description: "specify port"
17
+ },
18
+ host: {
19
+ type: "string",
20
+ description: "specify hostname"
21
+ }
22
+ },
23
+ async run({ args }) {
24
+ const rootDir = resolve(args.dir || args._dir || ".");
25
+ const server = serve({
26
+ fetch(req) {
27
+ return preview.fetch(req);
28
+ },
29
+ middleware: [log()],
30
+ gracefulShutdown: false,
31
+ port: args.port,
32
+ hostname: args.host
33
+ });
34
+ const preview = await startPreview({
35
+ rootDir,
36
+ loader: { srvxServer: server }
37
+ });
38
+ if (preview.upgrade) server.node?.server?.on("upgrade", (req, socket, head) => {
39
+ preview.upgrade(req, socket, head);
40
+ });
41
+ process.on("SIGINT", async () => {
42
+ await server.close();
43
+ await preview.close();
44
+ process.exit(0);
45
+ });
46
+ }
47
+ });
48
+ export { preview_default as default };
@@ -1,10 +1,8 @@
1
- import { ct as resolve } from "../../_build/common.mjs";
1
+ import { dt as resolve } from "../../_build/common.mjs";
2
2
  import { t as defineCommand } from "../../_libs/citty.mjs";
3
- import { consola } from "consola";
3
+ import { consola as consola$1 } from "consola";
4
4
  import destr from "destr";
5
5
  import { loadOptions, runTask } from "nitro/builder";
6
-
7
- //#region src/cli/commands/task/run.ts
8
6
  var run_default = defineCommand({
9
7
  meta: {
10
8
  name: "run",
@@ -28,10 +26,10 @@ var run_default = defineCommand({
28
26
  async run({ args }) {
29
27
  const cwd = resolve(args.dir || args.cwd || ".");
30
28
  const options = await loadOptions({ rootDir: cwd }).catch(() => void 0);
31
- consola.info(`Running task \`${args.name}\`...`);
29
+ consola$1.info(`Running task \`${args.name}\`...`);
32
30
  let payload = destr(args.payload || "{}");
33
31
  if (typeof payload !== "object") {
34
- consola.error(`Invalid payload: \`${args.payload}\` (it should be a valid JSON object)`);
32
+ consola$1.error(`Invalid payload: \`${args.payload}\` (it should be a valid JSON object)`);
35
33
  payload = void 0;
36
34
  }
37
35
  try {
@@ -43,13 +41,11 @@ var run_default = defineCommand({
43
41
  cwd,
44
42
  buildDir: options?.buildDir || ".nitro"
45
43
  });
46
- consola.success("Result:", result);
44
+ consola$1.success("Result:", result);
47
45
  } catch (error) {
48
- consola.error(`Failed to run task \`${args.name}\`: ${error}`);
46
+ consola$1.error(`Failed to run task \`${args.name}\`: ${error}`);
49
47
  process.exit(1);
50
48
  }
51
49
  }
52
50
  });
53
-
54
- //#endregion
55
- export { run_default as default };
51
+ export { run_default as default };
@@ -1,6 +1,4 @@
1
1
  import { t as defineCommand } from "../../_libs/citty.mjs";
2
-
3
- //#region src/cli/commands/task/index.ts
4
2
  var task_default = defineCommand({
5
3
  meta: {
6
4
  name: "task",
@@ -11,6 +9,4 @@ var task_default = defineCommand({
11
9
  run: () => import("./run.mjs").then((r) => r.default)
12
10
  }
13
11
  });
14
-
15
- //#endregion
16
- export { task_default as default };
12
+ export { task_default as default };
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { n as runMain, t as defineCommand } from "../_libs/citty.mjs";
3
3
  import { version } from "nitro/meta";
4
-
5
- //#region src/cli/index.ts
6
4
  runMain(defineCommand({
7
5
  meta: {
8
6
  name: "nitro",
@@ -12,10 +10,11 @@ runMain(defineCommand({
12
10
  subCommands: {
13
11
  dev: () => import("./_chunks/dev.mjs").then((r) => r.default),
14
12
  build: () => import("./_chunks/build.mjs").then((r) => r.default),
13
+ deploy: () => import("./_chunks/deploy.mjs").then((r) => r.default),
15
14
  prepare: () => import("./_chunks/prepare.mjs").then((r) => r.default),
16
- task: () => import("./_chunks/task.mjs").then((r) => r.default)
15
+ task: () => import("./_chunks/task.mjs").then((r) => r.default),
16
+ preview: () => import("./_chunks/preview.mjs").then((r) => r.default),
17
+ docs: () => import("./_chunks/docs.mjs").then((r) => r.default)
17
18
  }
18
19
  }));
19
-
20
- //#endregion
21
- export { };
20
+ export {};
@@ -0,0 +1,56 @@
1
+ # Introduction
2
+
3
+ > Nitro is a full-stack server framework, compatible with any runtime and any deployment target.
4
+
5
+ Nitro gives you a production-ready server with filesystem routing, code-splitting, and built-in support for storage, caching, and databases — all runtime-agnostic and deployable anywhere.
6
+
7
+ ## What is Nitro?
8
+
9
+ Create server and API routes inside the `routes/` directory. Each file maps directly to a URL path, and Nitro handles the rest — routing, code-splitting, and optimized builds.
10
+
11
+ You can also take full control of the server entry by creating a `server.ts` file. Nitro’s high-level, runtime-agnostic approach lets you use any HTTP library, such as [Elysia](https://elysiajs.com/), [h3](https://h3.dev), or [Hono](https://hono.dev).
12
+
13
+ ### Performance
14
+
15
+ Nitro compiles your routes at build time, removing the need for a runtime router. Only the code required to handle each incoming request is loaded and executed. This makes it ideal for serverless hosting, with near-0ms boot time regardless of project size.
16
+
17
+ ### Deploy Anywhere
18
+
19
+ Build your server into an optimized `.output/` folder compatible with Node.js, Bun, Deno, and many hosting platforms without any configuration — Cloudflare Workers, Netlify, Vercel, and more. Take advantage of platform features like ESR, ISR, and SWR without changing a single line of code.
20
+
21
+ ### Server-Side Rendering
22
+
23
+ Render HTML with your favorite templating engine, or use component libraries such as React, Vue, or Svelte directly on the server. Go full universal rendering with client-side hydration. Nitro provides the foundation and a progressive approach to reach your goals.
24
+
25
+ ### Storage
26
+
27
+ Nitro includes a runtime-agnostic key-value storage layer out of the box. It uses in-memory storage by default, but you can connect more than 20 different drivers (FS, Redis, S3, etc.), attach them to different namespaces, and swap them without changing your code.
28
+
29
+ ### Caching
30
+
31
+ Nitro supports caching for both server routes and server functions, backed directly by the server storage (via the `cache` namespace).
32
+
33
+ ### Database
34
+
35
+ Nitro also includes a built-in SQL database. It defaults to SQLite, but you can connect to and query more than 10 databases (Postgres, MySQL, PGLite, etc.) using the same API.
36
+
37
+ ### Meta-Framework Foundation
38
+
39
+ Nitro can be used as the foundation for building your own meta-framework. Popular frameworks such as Nuxt, SolidStart, and TanStack Start fully or partially leverage Nitro.
40
+
41
+ ## Vite Integration
42
+
43
+ Nitro integrates seamlessly with [Vite](https://vite.dev) as a plugin. If you’re building a frontend application with Vite, adding Nitro gives you API routes, server-side rendering, and a full production server — all built together with `vite build`.
44
+
45
+ ```ts [vite.config.ts]
46
+ import { defineConfig } from "vite";
47
+ import { nitro } from "nitro/vite";
48
+
49
+ export default defineConfig({
50
+ plugins: [nitro()],
51
+ });
52
+ ```
53
+
54
+ With Nitro, `vite build` produces an optimized `.output/` folder containing both your frontend and backend — ready to deploy anywhere.
55
+
56
+ Ready to give it a try? Jump into the [quick start](/docs/quick-start).
@@ -0,0 +1,110 @@
1
+ # Quick Start
2
+
3
+ > Start with a fresh Nitro project or adopt it in your current Vite project.
4
+
5
+ ## Try Nitro online
6
+
7
+ Get a taste of Nitro in your browser using our playground.
8
+
9
+ [Play with Nitro in StackBlitz](https://stackblitz.com/github/nitrojs/starter/tree/v3-vite?file=index.html,server.ts)
10
+
11
+ ## Create a Nitro project
12
+
13
+ The fastest way to create a Nitro application is using the `create-nitro-app`.
14
+
15
+ > [!NOTE]
16
+ > Make sure to have installed the latest LTS version of either [Node.js](https://nodejs.org/en), [Bun](https://bun.sh/), or [Deno](https://deno.com/).
17
+
18
+ <pm-x></pm-x>
19
+
20
+ Follow the instructions from the CLI and you will be ready to start your development server.
21
+
22
+ ## Add to a Vite project
23
+
24
+ You can add Nitro to any existing Vite project to get API routes, server-side rendering, and more.
25
+
26
+ <steps>
27
+
28
+ ### Install `nitro` and `vite`
29
+
30
+ <pm-install></pm-install>
31
+
32
+ ### Add Nitro plugin to Vite
33
+
34
+ Add the Nitro plugin to your `vite.config.ts`:
35
+
36
+ ```ts [vite.config.ts] {2,6}
37
+ import { defineConfig } from "vite";
38
+ import { nitro } from "nitro/vite";
39
+
40
+ export default defineConfig({
41
+ plugins: [
42
+ nitro()
43
+ ],
44
+ });
45
+ ```
46
+
47
+ ### Configure Nitro
48
+
49
+ Create a `nitro.config.ts` to configure the server directory:
50
+
51
+ ```ts [nitro.config.ts]
52
+ import { defineConfig } from "nitro";
53
+
54
+ export default defineConfig({
55
+ serverDir: "./server",
56
+ });
57
+ ```
58
+
59
+ The `serverDir` option tells Nitro where to look for your server routes. In this example, all routes will be inside the `server/` directory.
60
+
61
+ ### Create an API route
62
+
63
+ Create your first API route at `server/api/test.ts`:
64
+
65
+ <code-tree>
66
+
67
+ ```ts [server/api/test.ts]
68
+ import { defineHandler } from "nitro";
69
+
70
+ export default defineHandler(() => {
71
+ return { message: "Hello Nitro!" };
72
+ });
73
+ ```
74
+
75
+ ```ts [nitro.config.ts]
76
+ import { defineConfig } from "nitro";
77
+
78
+ export default defineConfig({
79
+ serverDir: "./server",
80
+ });
81
+ ```
82
+
83
+ ```ts [vite.config.ts]
84
+ import { defineConfig } from "vite";
85
+ import { nitro } from "nitro/vite";
86
+
87
+ export default defineConfig({
88
+ plugins: [nitro()],
89
+ });
90
+ ```
91
+ </code-tree>
92
+
93
+ The file path maps directly to the route URL — `server/api/test.ts` becomes `/api/test`.
94
+
95
+ <tip>
96
+
97
+ As an alternative to filesystem routing, you can declare routes programmatically using the `routes` config option. See [Programmatic route handlers](/docs/routing#programmatic-route-handlers) for more details.
98
+ </tip>
99
+
100
+ <tip>
101
+
102
+ You can return strings, JSON objects, `Response` instances, or readable streams from your handlers. See [Routing](/docs/routing) for more about dynamic routes, methods, and middleware.
103
+ </tip>
104
+
105
+ ### Start the development server
106
+
107
+ <pm-run></pm-run>
108
+
109
+ Your API route is now accessible at `http://localhost:3000/api/test` :sparkles:
110
+ </steps>