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

How to call other domain from inside fullmoon? #37

Closed
kuslahne opened this issue May 3, 2024 · 1 comment
Closed

How to call other domain from inside fullmoon? #37

kuslahne opened this issue May 3, 2024 · 1 comment
Assignees

Comments

@kuslahne
Copy link

kuslahne commented May 3, 2024

Thank you for your great framework.
Is there an example for accessing other url from fullmoon let say I need to fetch json data from https://jsonplaceholder.typicode.com/todos/1 and prosess their response? Is this possible without using ajax in js file? Or we can use external lua package? There is no documentation for HTTP client access here.

Thank you

@pkulchenko pkulchenko self-assigned this May 3, 2024
@pkulchenko
Copy link
Owner

Yes, you should definitely be able to do that. Redbean provides Fetch function (available as fm.fetch from fullmoon) that allows submitting http/https requests and processing of responses (including redirects).

This would be the simplest call: assert(fm.fetch("https://imgs.xkcd.com/comics/star_ratings.png")).

I'll update the documentation to mention that and include some examples. Feel free to re-open if you have other questions.

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

2 participants