How to use the @creditkarma/thrift-client.createClient function in @creditkarma/thrift-client

To help you get started, we’ve selected a few @creditkarma/thrift-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kevinbgreene / thrift-tutorial / src / content / server.ts View on Github external
(async function startContentServer() {
    const app: express.Application = express()
    const serverConfig = await config().get('content.server')
    const clientConfig = await config().get('content.client')

    const userClientV1: UserService.Client = createClient(UserService.Client, clientConfig)

    const serviceHandler: ContentService.IHandler = {
        getPost(id: number, context?: express.Request): Promise {
            console.log(`ContentService: getPost[${id}]`)
            const post: IMockPost | undefined = findPost(id)
            if (post !== undefined) {
                return userClientV1.getUser(post.author).then((author: User) => {
                    return new Post({
                        id: post.id,
                        author,
                        date: new PublishedDate(post.date),
                        title: post.title,
                        body: post.body,
                    })
                })
            } else {