Socket
Socket
Sign inDemoInstall

@elysiajs/eden

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elysiajs/eden

Fully type-safe Elysia client


Version published
Weekly downloads
11K
decreased by-9.23%
Maintainers
1
Weekly downloads
 
Created
Source

@elysiajs/eden

Fully type-safe Elysia client.

Installation

bun add @elysiajs/eden
bun add -d elysia

note

Eden requires type definition from elysia to infer type accurately, it's recommended to install elysia as devDependencies with the same version as your API.

Example

// server.ts
import { Elysia, t } from 'elysia'

const app = new Elysia()
    .get('/', () => 'Hi Elysia')
    .get('/id/:id', ({ params: { id } }) => id)
    .post('/mirror', ({ body }) => body, {
        schema: {
            body: t.Object({
                id: t.Number(),
                name: t.String()
            })
        }
    })
    .listen(8080)

export type App = typeof app

// client.ts
import { eden } from '@elysiajs/eden'
import type { App } from './server'

const client = eden<App>('http://localhost:8080')

// return: Hi Elysia (fully type-safe)
client.index.get().then(console.log)

// return: 1895
client.id.1895.get().then(console.log)

// return: { id: 1895, name: 'Skadi' }
client.mirror.post({
    id: 1895,
    name: 'Skadi'
}).then(console.log)

Keywords

FAQs

Package last updated on 22 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc