Skip to content

Commit

Permalink
docs: fix on mobile long path
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux authored Mar 4, 2023
1 parent c578df8 commit 1d2f57e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 23 deletions.
19 changes: 10 additions & 9 deletions docs/content/1.guide/1.introduction/0.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Let's create a new Nitro app in few steps.

## Play Online

: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;"}
: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 CodeSandox]{href="https://codesandbox.io/p/sandbox/nitro-template-5jssbm" icon="simple-icons:codesandbox" blank}

## Using Starter Template
## Starter Template

Before getting started, please make sure you have installed the recommended setup:

Expand All @@ -17,7 +17,6 @@ Before getting started, please make sure you have installed the recommended setu

Create a new project using starter template:


::code-group

```bash [npx]
Expand Down Expand Up @@ -53,10 +52,10 @@ pnpm install
::


Start development server:
Start the development server:

```bash
npx nitropack dev
npm run dev
```

🪄 Your API is ready at `http://localhost:3000/`
Expand All @@ -65,15 +64,17 @@ npx nitropack dev
Check `.nitro/dev/index.mjs` if want to know what is happening
::

You can now build your production-ready server:
Build your production-ready server:

```bash
npx nitropack build
npm run build
````

Output is in the `.output` directory and ready to be deployed on almost any provider with no dependencies. You can locally try it too:
Output is in the `.output` directory and ready to be deployed on almost any provider with no dependencies.

You can try it locally with:

```bash
node .output/server/index.mjs
npm run preview
```

36 changes: 25 additions & 11 deletions docs/content/1.guide/1.introduction/1.configuration.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
# Configuration

Customize your Nitro app with a configuration file.
You can customize your Nitro server with single configuration file: `nitro.config.ts`.

In order to customize nitro's behavior, we can use `nitro.config.ts`.
All deployment providers are built on the same options API.

It is powerful enough that all deployment providers are built on the same options API.

Create a new `nitro.config.ts` file to provide options:
If you are using [Nuxt](https://nuxt.com), use the `nitro` option in your Nuxt config.

::code-group
```ts [nitro.config.ts]
import { defineNitroConfig } from 'nitropack'

export default defineNitroConfig({
// Your options
// Nitro options
})
```
```ts [nuxt.config.ts]
export default defineNuxtConfig({
nitro: {
// Nitro options
}
})
```

::alert
**More Features Available!**
:br
Nitro handles configuration loading using [unjs/c12](https://github.com/unjs/c12). You have more advanced possibilities such as using `.env`. And `.nitrorc`.
::

Read all the [available options](/config) to configure Nitro.

Nitro loads the configuration using [unjs/c12](https://github.com/unjs/c12), giving more possibilities such as using `.nitrorc`.

::code-group
```txt [.nitrorc]
timing=true
```
```txt [.nuxtrc]
nitro.timing=true
```
::
15 changes: 13 additions & 2 deletions docs/content/1.guide/1.introduction/2.auto-imports.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
# Auto Imports

Nitro is integrated with [unjs/unimport](https://github.com/unjs/unimport) and automatically imports utilities by usage with full tree-shaking support.
Nitro is using [unjs/unimport](https://github.com/unjs/unimport) to auto import utilities when used with full tree-shaking support.

## Available Auto Imports

- `defineCachedFunction(fn, options)`{lang=ts} / `cachedFunction(fn, options)`{lang=ts}
- `defineCachedEventHandler(handler, options)`{lang=ts}
- `cachedEventHandler(handler, options)`{lang=ts}
- `useRuntimeConfig()`{lang=ts}
- `useStorage(base?)`{lang=ts}
- `useNitroApp()`{lang=ts}
- `defineNitroPlugin(plugin)`{lang=ts}
- `nitroPlugin(plugin)`{lang=ts}
- `defineRenderHandler`
"getRouteRules",

Check [the source code](https://github.com/unjs/nitro/blob/main/src/imports.ts) for list of available auto imports.

With [TypeScript](/guide/introduction/typescript) enabled, you can easily see them as global utilities in your IDE.

::alert{type="info"}
Run `npx nitropack prepare` to generate the types for global auto-imports.
The types are auto generated for global auto-imports when running the `prepare` or `dev` command.
::

## Manual Imports
Expand Down
2 changes: 1 addition & 1 deletion docs/content/1.guide/1.introduction/5.cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default eventHandler(async (event) => {
```
::

The stars will be cached in development inside `.nitro/cache/functions/ghStars/<owner>/<repo>.json` with `value` being the number of stars.
The stars will be cached in development inside **.nitro/cache/functions/ghStars/&lt;owner&gt;/&lt;repo&gt;.json** with `value` being the number of stars.

```json
{"expires":1677851092249,"value":43991,"mtime":1677847492540,"integrity":"ZUHcsxCWEH"}
Expand Down

0 comments on commit 1d2f57e

Please sign in to comment.