Init backend

This commit is contained in:
Jovi Hsu 2021-11-02 00:58:24 +08:00
parent 5b07e503e7
commit 11bdf28d67
20 changed files with 101 additions and 61 deletions

8
.gitignore vendored
View File

@ -1,10 +1,2 @@
# Generated by Cargo
# will have compiled files and executables
/target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk

View File

@ -1,51 +1,6 @@
[package]
authors = [
"Jovi Hsu <jv.hsu@outlook.com>"
[workspace]
members = [
"backend",
"frontend",
]
categories = ["wasm", "web-programming", "sslvpn"]
description = ""
edition = "2021"
keywords = ["yew", "wasm", "wasm-bindgen", "web", "sslvpn"]
license = "MIT"
name = "webgateway"
readme = "README.md"
version = "0.1.0"
repository = "https://www.github.com/HsuJv/webgateway"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
wasm-bindgen = "^0.2"
yew = "0.18"
js-sys = "0.3.55"
web-sys = "0.3.55"
yew-router = "0.15"
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.6", optional = true }
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
wee_alloc = { version = "0.4", optional = true }
[features]
default = ["console_error_panic_hook", "wee_alloc"]
[dev-dependencies]
wasm-bindgen-test = "0.3.13"
[profile.dev]
panic = "unwind"
opt-level = 0
[profile.release]
panic = 'abort'
codegen-units = 1
opt-level = 's'
lto = true

29
backend/Cargo.toml Normal file
View File

@ -0,0 +1,29 @@
[package]
authors = [
"Jovi Hsu <jv.hsu@outlook.com>"
]
categories = ["wasm", "web-programming", "sslvpn"]
description = ""
edition = "2021"
keywords = ["yew", "wasm", "wasm-bindgen", "web", "sslvpn"]
license = "GPL3"
name = "webgateway-be"
readme = "README.md"
version = "0.1.0"
repository = "https://www.github.com/HsuJv/webgateway"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
[profile.dev]
panic = "unwind"
opt-level = 0
[profile.release]
panic = 'abort'
codegen-units = 1
opt-level = 's'
lto = true

3
backend/src/main.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

10
frontend/.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
# Generated by Cargo
# will have compiled files and executables
/target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk

51
frontend/Cargo.toml Normal file
View File

@ -0,0 +1,51 @@
[package]
authors = [
"Jovi Hsu <jv.hsu@outlook.com>"
]
categories = ["wasm", "web-programming", "sslvpn"]
description = ""
edition = "2021"
keywords = ["yew", "wasm", "wasm-bindgen", "web", "sslvpn"]
license = "GPL3"
name = "webgateway-fe"
readme = "README.md"
version = "0.1.0"
repository = "https://www.github.com/HsuJv/webgateway"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
wasm-bindgen = "^0.2"
yew = "0.18"
js-sys = "0.3.55"
web-sys = "0.3.55"
yew-router = "0.15"
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.6", optional = true }
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
wee_alloc = { version = "0.4", optional = true }
[features]
default = ["console_error_panic_hook", "wee_alloc"]
[dev-dependencies]
wasm-bindgen-test = "0.3.13"
[profile.dev]
panic = "unwind"
opt-level = 0
[profile.release]
panic = 'abort'
codegen-units = 1
opt-level = 's'
lto = true

View File

@ -1,6 +1,6 @@
mod app;
mod utils;
mod pages;
mod utils;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;