This project is a web scraper for news headlines on Hacker News. It is written in Rust and uses the reqwest
and scraper
crates.
The objective of this project is to learn compilation and deployment of Rust projects to WASIX and Wasmer Edge.
You must have the following installed on your machine:
To run the project from the wasmer/news-scraper
package you can simply do:
$ wasmer run wasmer/news-scraper --net --env PORT=3000
To run the project, clone the repository and run the following command:
cargo wasix build --release
This will compile the project to WASIX and output the compiled binary to target/wasm32-wasmer-wasi/release/news-scraper.wasm
.
To run the compiled binary, run the following command:
wasmer run target/wasm32-wasmer-wasi/release/news-scraper.wasm --net --env PORT=3000
This will run the compiled binary on port 3000. You can then access the web scraper at http://localhost:3000
using curl or a web browser.
To deploy the project on wasmer edge simply do:
wasmer deploy
Note: you must change the configurations in
wasmer.toml
andapp.yaml
to match your own wasmer profile.
You can also follow the full tutorial for this project here.
You can also access the deployed project and read the news from your terminal.
curl https://news-scraper.wasmer.app