razican / rust-web-template Goto Github PK
View Code? Open in Web Editor NEWThis repository pretends to give a starting point for a new website in Rust.
License: Other
This repository pretends to give a starting point for a new website in Rust.
License: Other
The Failure crate was created to replace error-chain. We should change the code to use it.
Many websites have tight first-load requirements. SEO often asks to reduce the number of requests, and to load most of the data asynchronously once the website is already loaded and visible. The template allows to do this, but it should be much easier.
Default templates should allow to add an asynchronous CSS and an asynchronous JS, that would be loaded after the main page load, maybe even on first interaction. All this code should be minified at compile time in different files than the default ones, maybe adding an _assync
suffix to the file name.
The template currently requires SASS and UglifyJS 3 to be installed in the system globally. This should be changed so that the compilation script itself downloads them if they are not yet there.
We should add Maud integration as shown in https://maud.lambda.xyz/web_frameworks.html#rocket for faster rendering.
The code does not currently by default allow metadata headers in HTML. This needs to improve so that keywords, descriptions, OG data and many other headers can easily be added.
The project needs some contributing guidelines so that contributors know how to proceed.
The template needs testing, also to encourage future developers to test their code. OAuth must be tested, as well as CSS/JaavaScript file retrieval and compression.
This project needs an issue/pull request template if it wants to receive contributions.
Webpack gives the option to add Rust code as webassembly, or combine multiple libraries easily.
Even though user authentication and session manager is not so difficult to set up, it should be included by default in the template, since it's going to be used by most applications.
To avoid any misbehavior of potential community or contributors, the project needs a good code of conduct, probably mostly copied from Rust's code of conduct, since it seems to work really well for the community.
Standard error pages must be created for 404, 500, and maybe even other errors. They must also respect JSON headers (so that they work in a JSON REST API too).
Compiling web_template v0.1.0 (/home/dell/Downloads/Rust-web-template-master)
error[E0432]: unresolved import super::super::schema::oauth_apps
--> src/db/models/oauth.rs:6:5
|
6 | use super::super::schema::oauth_apps;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no oauth_apps
in db::schema
error[E0432]: unresolved import rocket_contrib::Template
--> src/compress.rs:10:5
|
10 | use rocket_contrib::Template;
| ^^^^^^^^^^^^^^^^--------
| | |
| | help: a similar name exists in the module: templates
| no Template
in the root
error[E0432]: unresolved import rocket_contrib::Json
--> src/compress.rs:109:13
|
109 | use rocket_contrib::Json;
| ^^^^^^^^^^^^^^^^----
| | |
| | help: a similar name exists in the module: json
| no Json
in the root
error[E0432]: unresolved import rocket_contrib::Json
--> src/api/v1/oauth.rs:5:5
|
5 | use rocket_contrib::Json;
| ^^^^^^^^^^^^^^^^----
| | |
| | help: a similar name exists in the module: json
| no Json
in the root
error[E0432]: unresolved import rocket_contrib::Template
--> src/lib.rs:45:5
|
45 | use rocket_contrib::Template;
| ^^^^^^^^^^^^^^^^--------
| | |
| | help: a similar name exists in the module: templates
| no Template
in the root
error: cannot find attribute post
in this scope
--> src/api/v1/oauth.rs:129:3
|
129 | #[post("/refresh_token", data = "")]
| ^^^^
error: cannot find attribute get
in this scope
--> src/api/v1/oauth.rs:145:3
|
145 | #[get("/access_token")]
| ^^^
error: cannot find attribute get
in this scope
--> src/lib.rs:50:3
|
50 | #[get("/")]
| ^^^
error: cannot find attribute get
in this scope
--> src/lib.rs:84:3
|
84 | #[get("/img/<file..>")]
| ^^^
error: cannot find attribute get
in this scope
--> src/lib.rs:90:3
|
90 | #[get("/favicon.ico")]
| ^^^
error: cannot find attribute get
in this scope
--> src/lib.rs:96:3
|
96 | #[get("/fav/browserconfig.xml")]
| ^^^
error: cannot find attribute get
in this scope
--> src/lib.rs:102:3
|
102 | #[get("/fav/manifest.json")]
| ^^^
error: cannot find attribute get
in this scope
--> src/lib.rs:108:3
|
108 | #[get("/fav/<file..>", rank = 2)]
| ^^^
error: cannot find attribute get
in this scope
--> src/lib.rs:114:3
|
114 | #[get("/css/<file..>")]
| ^^^
error: cannot find attribute get
in this scope
--> src/lib.rs:123:3
|
123 | #[get("/js/<file..>")]
| ^^^
error[E0412]: cannot find type AccessTokenResponse
in this scope
--> src/api/v1/oauth.rs:18:19
|
18 | access_token: AccessTokenResponse,
| ^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function hex_str
in this scope
--> src/api/v1/oauth.rs:24:30
|
24 | #[serde(serialize_with = "hex_str")]
| ^^^^^^^^^ not found in this scope
error[E0412]: cannot find type Scope
in this scope
--> src/api/v1/oauth.rs:140:16
|
139 | pub struct AccessToken {
| - help: you might be missing a type parameter: <Scope>
140 | scope: Vec,
| ^^^^^ not found in this scope
warning: use of deprecated item 'diesel_infer_schema': Diesel CLI can be configured to automatically run print-schema
after running migrations. See diesel.rs/guides/configuring-diesel-cli for details.
--> src/lib.rs:30:1
|
30 | extern crate diesel_infer_schema;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(deprecated)]
on by default
error[E0283]: type annotations needed for chrono::DateTime<Tz>
--> src/api/v1/oauth.rs:62:29
|
62 | let date_time = DateTime::from_utc(NaiveDateTime::from_timestamp(timestamp, 0), Utc);
| --------- ^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter Tz
| |
| consider giving date_time
the explicit type chrono::DateTime<Tz>
, where the type parameter Tz
is specified
|
= note: cannot satisfy _: chrono::TimeZone
= note: required by chrono::DateTime::<Tz>::from_utc
error: aborting due to 19 previous errors; 1 warning emitted
Some errors have detailed explanations: E0283, E0412, E0425, E0432.
For more information about an error, try rustc --explain E0283
.
error: could not compile web_template
.
To learn more, run the command again with --verbose
This repository has only the default labels. It needs many more so that issues and pull requests can be properly categorized and even selected for new (or/and inexperienced) contributors.
Documentation is currently not good enough. The project needs a proper setup guide, starting from installing Rust to coding custom request methods. It should contain explanations on why the code was developed as it was.
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.