xvxx / vial Goto Github PK
View Code? Open in Web Editor NEW๐งช a micro micro-framework for rust
Home Page: http://vial.rs
License: Apache License 2.0
๐งช a micro micro-framework for rust
Home Page: http://vial.rs
License: Apache License 2.0
Hi! So far, I like vial a lot!
However I was wondering if support for Windows is planned? I think that vial would benefit a lot from being cross-platform!
That's all I want to know for now, thanks :).
i have my folder layed out as
.
โโโ assets
โย ย โโโ html
โย ย โย ย โโโ index.html
โย ย โโโ img
โย ย โโโ icon.ico
โโโ build.rs
โโโ Cargo.lock
โโโ Cargo.toml
โโโ src
โโโ main.rs
and my build.rs
use vial::bundle_assets;
fn main() {
bundle_assets!("assets/").expect("unable to bundle assets!");
}
Two tests fail when running in a windows environment.
The first is util > file_size. It appears that git will change the line endings of certain files automatically between unix and windows. So instead of finding 1052 and 25161 for the files in the test, it finds 1072 and 25835 respectively.
Additionally, the file_walker test fails. This is actually a problem with the PathBuf object which allows you to construct a path that ends up being a mix of UNIX and Windows-based file path separators. So rather than "tests/assets/rfcs/rfc1288.txt" you get
"tests/assets/rfcs\rfc1288.txt" as the comparison.
While anxiously awaiting the return of @xvxx from a fishing expedition [1], I forked the repo and made a few improvements. Glad to contribute upstream when the maintainer returns, but until then, I won't make a bunch of PR's for each one.
I accepted #10 #11 #7 #6 + a few others. a list:
How would you feel about replacing serde with the lighter-weight https://github.com/not-fl3/nanoserde for json serialization?
Currently the with_*()
functions for Response
all have different error-behavior:
with_json()
panics on serialization failure.with_asset()
will instead not panic, continue to execute and return a 404 upon attempting to retrieve the asset. This is the same behavior as if the route isn't even defined. Very confusing.with_file()
is the same as with_asset()
except that if there is an error opening the file a 500 code with the actual error embedded is returned instead of a 404.I think it should either be all panic, all returning a 500 with the included error text, a result be propagated somehow or the error message be printed in the "log". 404s are very confusing when the file you are trying to include doesn't exist as it looks like the route doesn't exist instead of the file not existing.
Minimum confusing example:
use vial::{routes, run};
routes! {
GET "/file" => |_| Response::from_file("I DO NOT EXIST");
}
fn main() {
_ = run!();
}
Output after two curls:
~ vial running at http://0.0.0.0:7667
GET 404 /file
GET 404 /route_not_existo
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.