Skip to content

Latest commit

 

History

History
81 lines (55 loc) · 1.34 KB

README.md

File metadata and controls

81 lines (55 loc) · 1.34 KB

elysiajs-nuxt

Easily integrates elysia with nuxt, now supporting @nuxt/devtools and @elysiajs/eden!

Demo

demo.mp4

Usage

Development Environment

  1. install packages
# currently only supports Bun
bun add elysiajs-nuxt
bun add nuxt elysia --dev
  1. 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' } }
})
  1. 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)
  1. 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

  1. compile the Client
bun --bun nuxt build src-client
  1. start the Server
# mandatory configuration!
NODE_ENV=production bun run src-server/index.ts

Example

Author

Languages