Skip to content

Commit

Permalink
Add serve command to build and serve static files
Browse files Browse the repository at this point in the history
- needed an http server to serve 'wasm' extension
- I typically use nginx in one-time docker container run mapped to local directory to serve files
  - needed to add custom nginx config to serve "application/wasm" mime type
- interested in adding info to Yew docs, looked at website which I then looked at Rollup example source
  - they recommend using python http server
- found myself on Rust WASM RFCs github page with "watch and serve" command RFC
  - rustwasm/rfcs#10
  • Loading branch information
jonknapp committed Mar 23, 2020
1 parent 8aaf1e5 commit b390a5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/target
**/*.rs.bk
Cargo.lock
bin/
pkg/
wasm-pack.log
7 changes: 7 additions & 0 deletions bin/serve.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env sh

wasm-pack build --target web

cd pkg
echo "Server started at http://localhost:8000 from $PWD"
docker run -p 8000:80 --rm -v "$HOME/.profile_sources/server/custom-types.conf":/etc/nginx/conf.d/custom-types.conf:ro -v "$PWD":/usr/share/nginx/html:ro nginx:alpine

0 comments on commit b390a5f

Please sign in to comment.