Skip to content

Commit

Permalink
feat(examples,docs): add Nitro & Nuxt examples (#613)
Browse files Browse the repository at this point in the history
* feat(examples,docs): add Nitro & Nuxt examples

* fix: remove README in Nuxt example

* fix: lockfile
  • Loading branch information
QuiiBz authored Feb 28, 2023
1 parent 06093d0 commit e4075f5
Show file tree
Hide file tree
Showing 13 changed files with 2,578 additions and 141 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ target/
crates/serverless/deployments/
.vercel/
storybook-static/
.nitro/
.output/
.nuxt/

.eslintcache
.DS_Store
Expand Down
4 changes: 4 additions & 0 deletions examples/nitro/nitro.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { defineNitroConfig } from 'nitropack';
export default defineNitroConfig({
preset: 'lagon',
});
13 changes: 13 additions & 0 deletions examples/nitro/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@lagon/example-nitro",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "nitropack dev",
"build": "nitropack build",
"lagon-dev": "pnpm build && lagon dev .output/server/index.mjs -p .output/public"
},
"dependencies": {
"nitropack": "^2.2.3"
}
}
2 changes: 2 additions & 0 deletions examples/nitro/routes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// @ts-expect-error missing type definition
export default defineEventHandler(() => 'nitro is amazing!');
1 change: 1 addition & 0 deletions examples/nuxt/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
5 changes: 5 additions & 0 deletions examples/nuxt/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<NuxtWelcome />
</div>
</template>
6 changes: 6 additions & 0 deletions examples/nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
nitro: {
preset: 'lagon',
},
});
16 changes: 16 additions & 0 deletions examples/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@lagon/example-nuxt",
"version": "0.1.0",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"lagon-dev": "pnpm build && lagon dev .output/server/index.mjs -p .output/public"
},
"devDependencies": {
"nuxt": "^3.2.2"
}
}
Binary file added examples/nuxt/public/favicon.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions examples/nuxt/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}
4 changes: 2 additions & 2 deletions examples/rakkas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "node dist/server",
"test": "pnpm test:typecheck",
"test:typecheck": "tsc -p tsconfig.json --noEmit",
"lagon-dev": "nr build && lagon dev dist/server/entry-lagon.js -p dist/client"
"lagon-dev": "pnpm build && lagon dev dist/server/entry-lagon.js -p dist/client"
},
"devDependencies": {
"@types/react": "^18.0.26",
Expand All @@ -24,4 +24,4 @@
"react-dom": "^18.2.0"
},
"version": null
}
}
12 changes: 10 additions & 2 deletions packages/docs/pages/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ This example replies with JSON, setting the proper `Content-Type` header. [See t

## Libraries

### HatTip

This example uses [HatTip](https://github.com/hattipjs/hattip), a minimalist express-like library that runs anywhere, via Lagon's adapter. [See the code](https://github.com/lagonapp/lagon/tree/main/examples/hattip)

### Hono

This example uses [Hono](https://honojs.dev), a small, simple, and ultrafast web framework, via Lagon's adapter. [See the code](https://github.com/lagonapp/lagon/tree/main/examples/hono)

### HatTip
### Nitro

This example uses [HatTip](https://github.com/hattipjs/hattip), a minimalist express-like library that runs anywhere, via Lagon's adapter. [See the code](https://github.com/lagonapp/lagon/tree/main/examples/hattip)
This example uses [Nitro](https://nitro.unjs.io/), a library to build and deploy universal JavaScript servers, via Lagon's preset. [See the code](https://github.com/lagonapp/lagon/tree/main/examples/nitro)

### Preact client-side rendering

Expand Down Expand Up @@ -58,6 +62,10 @@ This example uses [tRPC](https://trpc.io) server, to build typesafe APIs. [See t

This example uses [Astro](https://astro.build), a static site generator, with both SSR via Lagon's adapter and prerendering. [See the code](https://github.com/lagonapp/lagon/tree/main/examples/astro)

### Nuxt

This example uses [Nuxt](https://nuxt.com), the intuitive web framework for Vue, with SSR via Lagon's preset. [See the code](https://github.com/lagonapp/lagon/tree/main/examples/nuxt)

### Rakkas

This example uses [Rakkas](https://rakkasjs.org), a React framework powered by Vite, with SSR via Lagon's adapter. [See the code](https://github.com/lagonapp/lagon/tree/main/examples/rakkas)
Expand Down
Loading

4 comments on commit e4075f5

@vercel
Copy link

@vercel vercel bot commented on e4075f5 Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./packages/docs

docs-git-main-lagon.vercel.app
docs.lagon.app
lagon-docs.vercel.app
docs-lagon.vercel.app

@vercel
Copy link

@vercel vercel bot commented on e4075f5 Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dashboard – ./packages/dashboard

dash.lagon.app
dashboard-lagon.vercel.app
dashboard-git-main-lagon.vercel.app

@vercel
Copy link

@vercel vercel bot commented on e4075f5 Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

storybook – ./packages/ui

storybook-swart-eight.vercel.app
storybook-git-main-lagon.vercel.app
ui.lagon.app
storybook-lagon.vercel.app

@vercel
Copy link

@vercel vercel bot commented on e4075f5 Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

www – ./www

lagon.dev
www-git-main-lagon.vercel.app
lagon.app
www-lagon.vercel.app

Please sign in to comment.