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

Replace server.py with something a little more .NET #88

Closed
praeclarum opened this issue Mar 14, 2018 · 9 comments
Closed

Replace server.py with something a little more .NET #88

praeclarum opened this issue Mar 14, 2018 · 9 comments

Comments

@praeclarum
Copy link
Owner

praeclarum commented Mar 14, 2018

This static page server is used to make sure wasm files get the right content type and to enable XmlHttpRequests for the assemblies.

Python servers are fine for Linux and Mac, but don't work by default on Windows.

Let's replace it with a nice .NET script instead.

An F# script would be perfect, but I worry if that is too intimidating for C# devs.

Alternatively, maybe a dotnet tool or run configuration or some other magic could be used.

@psmulovics
Copy link

C# devs love F# ;)

@jrgcubano
Copy link

jrgcubano commented Mar 15, 2018

Great work @praeclarum!

The server.py example is for python 2, so if anyone out there is trying with python 3:

import http.server
import socketserver

PORT = 8000

class Handler(http.server.SimpleHTTPRequestHandler):
    pass

Handler.extensions_map['.wasm'] = 'application/wasm'

httpd = socketserver.TCPServer(("", PORT), Handler)

print("serving at port", PORT)
httpd.serve_forever()

@hoetz
Copy link

hoetz commented Mar 15, 2018

Maybe this can be used instead https://github.com/natemcmaster/dotnet-serve

@praeclarum
Copy link
Owner Author

@hoetz I saw that this morning! Yeah I will definitely check it out.

@praeclarum
Copy link
Owner Author

I've tried it out and dotnet-serve works well! Need to update the guides...

@praeclarum
Copy link
Owner Author

Updated the wiki

@psmulovics
Copy link

You still need to update 7. in the wiki :)

@praeclarum
Copy link
Owner Author

Thanks!

@MarcosCobena
Copy link

Hi guys,

Just to give ever another option if don't want to update .NET Core to its preview or have already installed Python 3.x like me :-)

Simply use "xsp4" bin from Mono's distribution to run a local server from CLI. In macOS, you can already type this if have Xamarin installed. In Windows, simply point to mono-project.org and download it.

Thanks!

-Marcos

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

5 participants