Skip to content

Commit

Permalink
feat: add a playground, in Nuxt (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qrzy authored Oct 24, 2023
1 parent 9e59f50 commit 683ec1d
Show file tree
Hide file tree
Showing 12 changed files with 6,447 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
],
"scripts": {
"nodetest": "node --version",
"playground": "cd playground && pnpm i && pnpm run dev",
"test": "vitest",
"build": "unbuild",
"lint": "eslint .",
Expand Down
24 changes: 24 additions & 0 deletions playground/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist

# Node dependencies
node_modules

# Logs
logs
*.log

# Misc
.DS_Store
.fleet
.idea

# Local env files
.env
.env.*
!.env.example
1 change: 1 addition & 0 deletions playground/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
75 changes: 75 additions & 0 deletions playground/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Nuxt 3 Minimal Starter

Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.

## Setup

Make sure to install the dependencies:

```bash
# npm
npm install

# pnpm
pnpm install

# yarn
yarn install

# bun
bun install
```

## Development Server

Start the development server on `http://localhost:3000`:

```bash
# npm
npm run dev

# pnpm
pnpm run dev

# yarn
yarn dev

# bun
bun run dev
```

## Production

Build the application for production:

```bash
# npm
npm run build

# pnpm
pnpm run build

# yarn
yarn build

# bun
bun run build
```

Locally preview production build:

```bash
# npm
npm run preview

# pnpm
pnpm run preview

# yarn
yarn preview

# bun
bun run preview
```

Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
18 changes: 18 additions & 0 deletions playground/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script setup lang="ts">
import { getBggSearch } from '../src'
const { data: serverData } = useFetch('/api/bggSearch/Blood-rage')
const searchData = ref<any>(null)
if (process.client)
searchData.value = await getBggSearch({ query: 'Blood rage', exact: 1, type: 'boardgame' })
</script>

<template>
<h1>Playground</h1>
<h2>Server API proxy Search data:</h2>
<pre>{{ serverData }}</pre>
<h2>Client Search data:</h2>
<pre>{{ searchData }}</pre>
</template>
4 changes: 4 additions & 0 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true }
})
18 changes: 18 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"devDependencies": {
"@nuxt/devtools": "latest",
"nuxt": "^3.8.0",
"vue": "^3.3.6",
"vue-router": "^4.2.5"
}
}
Loading

0 comments on commit 683ec1d

Please sign in to comment.