Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Elysia SnippetsNew to Visual Studio Code? Get it now.
Elysia Snippets

Elysia Snippets

Mohammadreza Hajianpour

|
367 installs
| (0) | Free
Quick and useful ElysiaJS snippets
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

ElysiaJS quick and useful snippets (Alpha)

  • elyctrl Creates an empty controller:
export const ExampleController = new Elysia({ name: 'Controller.Example' })`
  • elycrud

Creates a full CRUD rest controller:

import { Elysia, t } from 'elysia'

export const ExampleController = new Elysia({ name: 'Controller.Example', prefix: '/examples' })
  .get('/', () => {

  }, {
    detail: {
      description: 'Get all examples'
    },
  })
  .get('/:id', ({ params: { id } }) => {

  }, {
    params: t.Object({
      id: t.Number()
    }),
    detail: {
      description: 'Get one Example'
    }
  })
  .post('/', ({ body }) => {

  }, {
    body: t.Any(),
    detail: {
      description: 'Create one Example'
    }
  })
  .put('/:id', ({ body, params: { id } }) => {

  }, {
    params: t.Object({
      id: t.Number()
    }),
    body: t.Any(),
    detail: {
      description: 'Edit one Example'
    }
  })
  .delete('/:id', ({ params: { id } }) => {

  }, {
    params: t.Object({
      id: t.Number()
    }),
    detail: {
      description: 'Delete one Example'
    }
  })
  • elymod

Creates an empty model:

export const ExampleModel = new Elysia({ name: 'Model.Example' })
  .model({
    id: t.Number()
  })

Note: You may append i to any snippet shorthand to also import Elysia and t types.

License

Apache-2.0

Created By

Mohammadreza Hajianpour (Borderliner)

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft