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

add support for localhost paths in urlPath utility. #142

Open
M-Younis47 opened this issue Aug 14, 2023 · 4 comments
Open

add support for localhost paths in urlPath utility. #142

M-Younis47 opened this issue Aug 14, 2023 · 4 comments

Comments

@M-Younis47
Copy link

I am using a localhost server for sending h5p paths. It took few hours to figure out it does not support localhost urls and to make changes so that it does.

At first I directly added the localhost path (http://localhost:4000) in getJSON method url string. But now I added a regex for localhost urls in urlPath utility. Now its working fine for me.

It would be great to have this in by default. So that new programmers like me won't get headaches.

@0xMurage
Copy link
Collaborator

Kindly share more information on how to reproduce the issue

@M-Younis47
Copy link
Author

h5pJsonPath: '/h5p-folder', it works fine but it will fetch data from public folder of your project. But if we want to get h5p data from a back-end server running on localhost or server running without DNS name like 123.232.424.132 it produces an error it looks for data in /public folder of your project.

@0xMurage
Copy link
Collaborator

Set h5pJsonPath to be the URL of your server.

Your server should handle the following endpoints:

  1. /h5p.json: This endpoint should return the contents of the h5p.json file in the h5p-folder.

  2. /content.json: Only applies if you haven't provided the contentJsonPath parameter. This endpoint should return the contents of the content.json file.

The the specific implementation details of how to expose this endpoint and fetch the H5P JSON content are outside the scope of this library. However, if you are fetching the data on different url, ensure to enable CORs on that server.

@M-Younis47
Copy link
Author

I used this libary with a different approach to avoid the issue. But to clear out what actually happend I will recreate the issue and get back to you with more details asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants