Skip to content

Commit 516a35a

Browse files
authored
Add Nitro framework boilerplate (#1149)
### Description Nitro build detects the env var `VERCEL=1` and emits build output API code, so Nitro already works great on Vercel with zero configuration. This example is necessary to add the [Nitro framework entry](vercel/vercel#13472). ### Demo URL https://nitro-template.vercel.app ### Type of Change - [X] New Example - [ ] Example updates (Bug fixes, new features, etc.) - [ ] Other (changes to the codebase, but not to examples) ### New Example Checklist - [ ] 🛫 `npm run new-example` was used to create the example - [X] 📚 The template wasn't used but I carefuly read the [Adding a new example](https://github.com/vercel/examples#adding-a-new-example) steps and implemented them in the example - [X] 📱 Is it responsive? Are mobile and tablets considered?
1 parent 424099e commit 516a35a

File tree

7 files changed

+52
-0
lines changed

7 files changed

+52
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
dist
3+
.data
4+
.nitro
5+
.cache
6+
.output
7+
.env
8+
.vercel
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shamefully-hoist=true
2+
strict-peer-dependencies=false
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Nitro
2+
3+
This directory is a brief example of [Nitro](https://nitro.build/) that can be deployed to Vercel with zero configuration. Go to the [nitro quick start](https://nitro.unjs.io/guide#quick-start) to learn more.
4+
5+
## Deploy Your Own
6+
7+
Deploy your own Nitro project with Vercel.
8+
9+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/framework-boilerplates/nitro&template=nitro)
10+
11+
_Live Example: https://nitro-template.vercel.app//_
12+
13+
## Developing
14+
15+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
16+
17+
```bash
18+
npm run dev
19+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//https://nitro.unjs.io/config
2+
export default defineNitroConfig({
3+
srcDir: "server"
4+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"build": "nitro build",
5+
"dev": "nitro dev",
6+
"prepare": "nitro prepare",
7+
"preview": "node .output/server/index.mjs"
8+
},
9+
"devDependencies": {
10+
"nitropack": "latest"
11+
}
12+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default defineEventHandler((event) => {
2+
return "Start by editing <code>server/routes/index.ts</code>.";
3+
});
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// https://nitro.unjs.io/guide/typescript
2+
{
3+
"extends": "./.nitro/types/tsconfig.json"
4+
}

0 commit comments

Comments
 (0)