Skip to content

Commit

Permalink
docs: update getting started page (#2082)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barbapapazes authored Jan 23, 2024
1 parent 73ab96f commit b1dd2db
Showing 1 changed file with 40 additions and 6 deletions.
46 changes: 40 additions & 6 deletions docs/content/1.guide/0.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ icon: ri:rocket-2-line

# Getting Started

Let's create a new Nitro app in few steps.
<!-- TODO: Better introduction Under the hood, Nitro is using [h3](https://h3.unjs.io) as HTTP framework, embeds many utilities (file routing, storage, cache...) and preconfigured packages like [unimports](https://unimports.unjs.io) or [unstorage](https://unstorage.unjs.io) and provide a set of presets to deploy your server anywhere.
Now you know what Nitro is, let's get started and create your first Nitro app!
-->

## Play Online

The easiest way to get started with Nitro is to use the online playground.

:button-link[Open on Stackblitz]{href="https://stackblitz.com/github/unjs/nitro/tree/main/examples/hello-world" icon="simple-icons:stackblitz" blank style="margin-right: 10px;margin-bottom:10px;"}
:button-link[Open on CodeSandbox]{href="https://codesandbox.io/p/sandbox/nitro-template-5jssbm" icon="simple-icons:codesandbox" blank}

Expand All @@ -17,8 +23,8 @@ Let's create a new Nitro app in few steps.
#summary
Make sure you have installed the recommended setup:
#content
* **Node.js**<sup>*</sup> (latest LTS version) 👉 [[Download](https://nodejs.org/en/download/)]
* **Visual Studio Code** [[Download](https://code.visualstudio.com/)]
* **Node.js**<sup>*</sup> (latest LTS version) 👉 [Download](https://nodejs.org/en/download/)
* **Visual Studio Code** [Download](https://code.visualstudio.com/)
* [corepack](https://nodejs.org/api/corepack.html) for using pnpm and yarn. 👉 Run `corepack enable`
::

Expand Down Expand Up @@ -66,14 +72,13 @@ bun install

::


Start the development server:

```bash
npm run dev
```

🪄 Your API is ready at `http://localhost:3000/`
Nitro is ready at `http://localhost:3000/`!

::alert
Check `.nitro/dev/index.mjs` if want to know what is happening
Expand All @@ -83,7 +88,7 @@ Build your production-ready server:

```bash
npm run build
````
```

Output is in the `.output` directory and ready to be deployed on almost any provider with no dependencies.

Expand All @@ -93,6 +98,35 @@ You can try it locally with:
npm run preview
```

::alert{type="info"}
You can find more examples in the Nitro repository: [unjs/nitro/examples](https://github.com/unjs/nitro/tree/main/examples)
::

### Files

The starter template some important files to get you started.

`package.json`

The `package.json` file contains all the dependencies and scripts for your project.

`nitro.config.ts`

The `nitro.config.ts` file contains the configuration for Nitro.

`tsconfig.json`

The `tsconfig.json` file contains the TypeScript configuration for your project. It extends an automatically generated `./.nitro/types/tsconfig.json` file that contains the configuration for Nitro.

You can use `npm run prepare` to generate some Nitro files in `.nitro` directory.

::alert{type="info"}
Do not change this file directly, use `typescript` key in `nitro.config.ts` instead.
::

`routes/**/*.{ts,js}`

The `routes` directory contains your application handlers. You can create subdirectories inside `routes` to create nested handlers. The file name is the route path.

## Nightly Release Channel

Expand Down

0 comments on commit b1dd2db

Please sign in to comment.