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

Added browser chat example #4022

Merged
merged 5 commits into from
Feb 22, 2020
Merged

Added browser chat example #4022

merged 5 commits into from
Feb 22, 2020

Conversation

keroxp
Copy link
Contributor

@keroxp keroxp commented Feb 17, 2020

https://gyazo.com/4ef820595ecf72bbd83a158dc1e36212

@ry
Copy link
Member

ry commented Feb 18, 2020

Cool! I realize we don't have tests in the examples directory - but we should - I wonder if you'd be able to provide a basic test for this? Otherwise it's quite likely it will break...

@keroxp
Copy link
Contributor Author

keroxp commented Feb 18, 2020

I've realized that remote modules can't serve file that located on the remote server...

deno --allow-net --allow-read https://deno.land/std/examples/chat/server.ts

It won't work after merged :(

@ry
Copy link
Member

ry commented Feb 18, 2020

@keroxp Can you use import.meta.url to get the location of the html asset?

@keroxp
Copy link
Contributor Author

keroxp commented Feb 19, 2020

@ry No, maybe. There is no way to "open" remote file from local.

// deno -A https://deno.land/std/example/chat/server.ts -> https://deno.land/std/examples/chat/index.html 
// deno -A ./server.ts -> file:///src/deno/std/examples/chat/server.ts
const f = new URL("./index.html", import.meta.url).href;
fetch(f).then(resp => req.respond(resp))

Code above worked for deno -A http://.... but didn't work for deno -a ./server.ts.
Deno.open()doesn't accept http://... and fetch() doesn't file://...

@keroxp
Copy link
Contributor Author

keroxp commented Feb 19, 2020

Additionally I found another bug #4038

@keroxp
Copy link
Contributor Author

keroxp commented Feb 22, 2020

@ry I fixed those problems by hacky way. Would you see the change?

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks - LGTM

@ry ry merged commit 8b646e8 into denoland:master Feb 22, 2020
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 21, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 24, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Jan 31, 2021
caspervonb pushed a commit to caspervonb/deno_std that referenced this pull request Feb 1, 2021
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