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

Allow executing async functions from TypeScript REST framework #4247

Open
iliyan-velichkov opened this issue Aug 22, 2024 · 0 comments
Open

Comments

@iliyan-velichkov
Copy link
Contributor

iliyan-velichkov commented Aug 22, 2024

For example:

import { Controller, Post } from "sdk/http"
import { ConcatenateParamsDTO, ConcatenateResultDTO } from "./concatenate-dto"
import { execute } from "/string-util/dist/run.mjs"

@Controller
class SnowflakeService {

    @Post("/concatenate")
    public async concatenate(params: ConcatenateParamsDTO): Promise<ConcatenateResultDTO> {
        const abapParams = {
            iv_string1: params.param1,
            iv_string2: params.param2
        };
        const result = await execute(abapParams);
        console.log("Result in REST: " + result);
        return {
            result: result
        };
    }

}

Motivation: I want to be able to call async function from the REST and return the response synchronously.
Dirigible project reference: https://github.com/codbex/abap-samples/blob/15e7b3426d585cb35bf320e8fa625bf18b43f0e7/snowflake-api-project/api/SnowflakeService.ts#L29

iliyan-velichkov added a commit to codbex/abap-samples that referenced this issue Aug 22, 2024
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

No branches or pull requests

1 participant