1.0.0-rc.13 • Published 1 year ago

@exobase/use-route v1.0.0-rc.13

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Provides an Exobase hook that will do simple method/route routing to differnet endpoint functions.

Usage

import { compose } from 'radash'
import type { Props } from '@exobase/core'
import { useNext } from '@exobase/use-next'
import { useRoute } from '@exobase/use-route'

export const listLibraries = async (props: Props) => {
  return db.libraries.list()
}

export const listBooks = async (props: Props) => {
  return db.books.list()
}

export default compose(
  useNext(),
  useRoute('GET', '/library', listLibraries)
  useRoute('GET', '/library/books', listBooks)
  async () => {
    throw new Error('404 Not found')
  }
)
1.0.0-rc.13

1 year ago

1.0.0-rc.12

1 year ago

1.0.0-rc.11

1 year ago

1.0.0-rc.10

1 year ago

1.0.0-rc.9

1 year ago

1.0.0-rc.8

1 year ago

1.0.0-rc.7

1 year ago

1.0.0-rc.6

2 years ago

1.0.0-rc.5

2 years ago

1.0.0-rc.4

2 years ago

1.0.0-rc.3

2 years ago

1.0.0-rc.2

2 years ago