Let's create a new Nitro app!
🏀 Online playground on StackBlitz
Create an empty directory nitro-app
mkdir nitro-appcd nitro-app
Create routes/index.ts
:
export default defineEventHandler(() => 'nitro is amazing!')
Start development server:
npx nitropack dev
🪄 Your API is ready at http://localhost:3000/
Tip: Check .nitro/dev/index.mjs
if want to know what is happening
You can now build your production-ready server:
npx nitropack build
Output is in the .output
directory and ready to be deployed on almost any VPS with no dependencies. You can locally try it too:
node .output/server/index.mjs
You can add nitropack
using your package manager now:
# npmnpm i -D nitropack# yarnyarn add -D nitropack# pnpmpnpm i -D nitropack