Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): Add typed client to a generated app #2669

Merged
merged 4 commits into from
Jun 20, 2022
Merged

feat(cli): Add typed client to a generated app #2669

merged 4 commits into from
Jun 20, 2022

Conversation

daffl
Copy link
Member

@daffl daffl commented Jun 18, 2022

This pull request adds a Feathers client module to the generated application. This means you can import your API in your client side React, VueJS etc. project and instantiate a client specifically for it. If you are using TypeScript it will use the service names and schemas declared on the server.

import io from 'socket.io-client'
import socketio from '@feathersjs/socketio-client'
import authentication from '@feathersjs/authentication-client'

import { createClient } from 'my-api'

const client = createClient(socketio(io))
  .configure(authentication)

const page = await client.service('users').find({
 query: {} // Get autocompletion for all query schema props
})

page.data // Will be UserResult[] type

@daffl daffl changed the title feat(cli): Add typed Feathers client to a generated app feat(cli): Add typed client to a generated app Jun 18, 2022
@marshallswain
Copy link
Member

:shipit:

@daffl daffl merged commit 5b801b5 into dove Jun 20, 2022
@daffl daffl deleted the typed-client branch June 20, 2022 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants