elysiajs-nuxt
v0.3.12
Published
> Easily integrates elysia with nuxt, now supporting @nuxt/devtools and @elysiajs/eden!
Downloads
27
Maintainers
Readme
elysiajs-nuxt
Easily integrates elysia with nuxt, now supporting @nuxt/devtools and @elysiajs/eden!
Demo
https://github.com/nuxt/nuxt/assets/13268073/d5c96902-698f-482a-8360-9f657ab40eba
Usage
Development Environment
- install packages
# currently only supports Bun
bun add elysiajs-nuxt
bun add nuxt elysia --dev
- configure nuxt.config.ts
// src-client/nuxt.config.ts
export default defineNuxtConfig({
// mandatory configuration!
nitro: { preset: import.meta.resolveSync('elysiajs-nuxt/preset') },
// mandatory configuration!
vite: { server: { origin: 'localhost:3000' } }
})
- use elysiajs-nuxt as a plugin
// src-server/index.ts
import { Elysia } from 'elysia'
import elysiaNuxt from 'elysiajs-nuxt'
new Elysia().use(elysiaNuxt).listen(5566)
- simultaneously start dev servers, both client(nuxt) and server(elysia)
# server
bun run --watch src-server
# client
bun --bun nuxt dev src-client/index.ts
Production Environment
- compile the Client
bun --bun nuxt build src-client
- start the Server
# mandatory configuration!
NODE_ENV=production bun run src-server/index.ts