···11+# Generated by Cargo
22+# will have compiled files and executables
33+debug/
44+target/
55+66+# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
77+# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
88+Cargo.lock
99+1010+# These are backup files generated by rustfmt
1111+**/*.rs.bk
1212+1313+# MSVC Windows builds of rustc generate these, which store debugging information
1414+*.pdb
+102
footnotes_appview/Cargo.toml
···11+[package]
22+name = "footnotes_appview"
33+version = "0.1.0"
44+edition = "2021"
55+66+[lib]
77+crate-type = ["cdylib", "rlib"]
88+99+[dependencies]
1010+leptos = { version = "0.8.0" }
1111+leptos_router = { version = "0.8.0" }
1212+axum = { version = "0.8.0", optional = true }
1313+console_error_panic_hook = { version = "0.1", optional = true }
1414+leptos_axum = { version = "0.8.0", optional = true }
1515+leptos_meta = { version = "0.8.0" }
1616+tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
1717+wasm-bindgen = { version = "=0.2.103", optional = true }
1818+1919+[features]
2020+hydrate = [
2121+ "leptos/hydrate",
2222+ "dep:console_error_panic_hook",
2323+ "dep:wasm-bindgen",
2424+]
2525+ssr = [
2626+ "dep:axum",
2727+ "dep:tokio",
2828+ "dep:leptos_axum",
2929+ "leptos/ssr",
3030+ "leptos_meta/ssr",
3131+ "leptos_router/ssr",
3232+]
3333+3434+# Defines a size-optimized profile for the WASM bundle in release mode
3535+[profile.wasm-release]
3636+inherits = "release"
3737+opt-level = 'z'
3838+lto = true
3939+codegen-units = 1
4040+panic = "abort"
4141+4242+[package.metadata.leptos]
4343+# The name used by wasm-bindgen/cargo-leptos for the JS/WASM bundle. Defaults to the crate name
4444+output-name = "footnotes_appview"
4545+4646+# The site root folder is where cargo-leptos generate all output. WARNING: all content of this folder will be erased on a rebuild. Use it in your server setup.
4747+site-root = "target/site"
4848+4949+# The site-root relative folder where all compiled output (JS, WASM and CSS) is written
5050+# Defaults to pkg
5151+site-pkg-dir = "pkg"
5252+5353+# [Optional] The source CSS file. If it ends with .sass or .scss then it will be compiled by dart-sass into CSS. The CSS is optimized by Lightning CSS before being written to <site-root>/<site-pkg>/app.css
5454+style-file = "style/main.scss"
5555+# Assets source dir. All files found here will be copied and synchronized to site-root.
5656+# The assets-dir cannot have a sub directory with the same name/path as site-pkg-dir.
5757+#
5858+# Optional. Env: LEPTOS_ASSETS_DIR.
5959+assets-dir = "public"
6060+6161+# The IP and port (ex: 127.0.0.1:3000) where the server serves the content. Use it in your server setup.
6262+site-addr = "127.0.0.1:3000"
6363+6464+# The port to use for automatic reload monitoring
6565+reload-port = 3001
6666+6767+# [Optional] Command to use when running end2end tests. It will run in the end2end dir.
6868+# [Windows] for non-WSL use "npx.cmd playwright test"
6969+# This binary name can be checked in Powershell with Get-Command npx
7070+end2end-cmd = "npx playwright test"
7171+end2end-dir = "end2end"
7272+7373+# The browserlist query used for optimizing the CSS.
7474+browserquery = "defaults"
7575+7676+# The environment Leptos will run in, usually either "DEV" or "PROD"
7777+env = "DEV"
7878+7979+# The features to use when compiling the bin target
8080+#
8181+# Optional. Can be over-ridden with the command line parameter --bin-features
8282+bin-features = ["ssr"]
8383+8484+# If the --no-default-features flag should be used when compiling the bin target
8585+#
8686+# Optional. Defaults to false.
8787+bin-default-features = false
8888+8989+# The features to use when compiling the lib target
9090+#
9191+# Optional. Can be over-ridden with the command line parameter --lib-features
9292+lib-features = ["hydrate"]
9393+9494+# If the --no-default-features flag should be used when compiling the lib target
9595+#
9696+# Optional. Defaults to false.
9797+lib-default-features = false
9898+9999+# The profile to use for the lib target when compiling for release
100100+#
101101+# Optional. Defaults to "release".
102102+lib-profile-release = "wasm-release"
+24
footnotes_appview/LICENSE
···11+This is free and unencumbered software released into the public domain.
22+33+Anyone is free to copy, modify, publish, use, compile, sell, or
44+distribute this software, either in source code form or as a compiled
55+binary, for any purpose, commercial or non-commercial, and by any
66+means.
77+88+In jurisdictions that recognize copyright laws, the author or authors
99+of this software dedicate any and all copyright interest in the
1010+software to the public domain. We make this dedication for the benefit
1111+of the public at large and to the detriment of our heirs and
1212+successors. We intend this dedication to be an overt act of
1313+relinquishment in perpetuity of all present and future rights to this
1414+software under copyright law.
1515+1616+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1717+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1818+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1919+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
2020+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2121+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2222+OTHER DEALINGS IN THE SOFTWARE.
2323+2424+For more information, please refer to <https://unlicense.org>
+91
footnotes_appview/README.md
···11+<picture>
22+ <source srcset="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_Solid_White.svg" media="(prefers-color-scheme: dark)">
33+ <img src="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_RGB.svg" alt="Leptos Logo">
44+</picture>
55+66+# Leptos Axum Starter Template
77+88+This is a template for use with the [Leptos](https://github.com/leptos-rs/leptos) web framework and the [cargo-leptos](https://github.com/akesson/cargo-leptos) tool using [Axum](https://github.com/tokio-rs/axum).
99+1010+## Creating your template repo
1111+1212+If you don't have `cargo-leptos` installed you can install it with
1313+1414+```bash
1515+cargo install cargo-leptos --locked
1616+```
1717+1818+Then run
1919+```bash
2020+cargo leptos new --git https://github.com/leptos-rs/start-axum
2121+```
2222+2323+to generate a new project template.
2424+2525+```bash
2626+cd footnotes_appview
2727+```
2828+2929+to go to your newly created project.
3030+Feel free to explore the project structure, but the best place to start with your application code is in `src/app.rs`.
3131+Additionally, Cargo.toml may need updating as new versions of the dependencies are released, especially if things are not working after a `cargo update`.
3232+3333+## Running your project
3434+3535+```bash
3636+cargo leptos watch
3737+```
3838+3939+## Installing Additional Tools
4040+4141+By default, `cargo-leptos` uses `nightly` Rust, `cargo-generate`, and `sass`. If you run into any trouble, you may need to install one or more of these tools.
4242+4343+1. `rustup toolchain install nightly --allow-downgrade` - make sure you have Rust nightly
4444+2. `rustup target add wasm32-unknown-unknown` - add the ability to compile Rust to WebAssembly
4545+3. `cargo install cargo-generate` - install `cargo-generate` binary (should be installed automatically in future)
4646+4. `npm install -g sass` - install `dart-sass` (should be optional in future
4747+5. Run `npm install` in end2end subdirectory before test
4848+4949+## Compiling for Release
5050+```bash
5151+cargo leptos build --release
5252+```
5353+5454+Will generate your server binary in target/release and your site package in target/site
5555+5656+## Testing Your Project
5757+```bash
5858+cargo leptos end-to-end
5959+```
6060+6161+```bash
6262+cargo leptos end-to-end --release
6363+```
6464+6565+Cargo-leptos uses Playwright as the end-to-end test tool.
6666+Tests are located in end2end/tests directory.
6767+6868+## Executing a Server on a Remote Machine Without the Toolchain
6969+After running a `cargo leptos build --release` the minimum files needed are:
7070+7171+1. The server binary located in `target/server/release`
7272+2. The `site` directory and all files within located in `target/site`
7373+7474+Copy these files to your remote server. The directory structure should be:
7575+```text
7676+footnotes_appview
7777+site/
7878+```
7979+Set the following environment variables (updating for your project as needed):
8080+```sh
8181+export LEPTOS_OUTPUT_NAME="footnotes_appview"
8282+export LEPTOS_SITE_ROOT="site"
8383+export LEPTOS_SITE_PKG_DIR="pkg"
8484+export LEPTOS_SITE_ADDR="127.0.0.1:3000"
8585+export LEPTOS_RELOAD_PORT="3001"
8686+```
8787+Finally, run the server binary.
8888+8989+## Licensing
9090+9191+This template itself is released under the Unlicense. You should replace the LICENSE for your own application with an appropriate license if you plan to release it publicly.
···11+import type { PlaywrightTestConfig } from "@playwright/test";
22+import { devices, defineConfig } from "@playwright/test";
33+44+/**
55+ * Read environment variables from file.
66+ * https://github.com/motdotla/dotenv
77+ */
88+// require('dotenv').config();
99+1010+/**
1111+ * See https://playwright.dev/docs/test-configuration.
1212+ */
1313+export default defineConfig({
1414+ testDir: "./tests",
1515+ /* Maximum time one test can run for. */
1616+ timeout: 30 * 1000,
1717+ expect: {
1818+ /**
1919+ * Maximum time expect() should wait for the condition to be met.
2020+ * For example in `await expect(locator).toHaveText();`
2121+ */
2222+ timeout: 5000,
2323+ },
2424+ /* Run tests in files in parallel */
2525+ fullyParallel: true,
2626+ /* Fail the build on CI if you accidentally left test.only in the source code. */
2727+ forbidOnly: !!process.env.CI,
2828+ /* Retry on CI only */
2929+ retries: process.env.CI ? 2 : 0,
3030+ /* Opt out of parallel tests on CI. */
3131+ workers: process.env.CI ? 1 : undefined,
3232+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
3333+ reporter: "html",
3434+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
3535+ use: {
3636+ /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
3737+ actionTimeout: 0,
3838+ /* Base URL to use in actions like `await page.goto('/')`. */
3939+ // baseURL: 'http://localhost:3000',
4040+4141+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
4242+ trace: "on-first-retry",
4343+ },
4444+4545+ /* Configure projects for major browsers */
4646+ projects: [
4747+ {
4848+ name: "chromium",
4949+ use: {
5050+ ...devices["Desktop Chrome"],
5151+ },
5252+ },
5353+5454+ {
5555+ name: "firefox",
5656+ use: {
5757+ ...devices["Desktop Firefox"],
5858+ },
5959+ },
6060+6161+ {
6262+ name: "webkit",
6363+ use: {
6464+ ...devices["Desktop Safari"],
6565+ },
6666+ },
6767+6868+ /* Test against mobile viewports. */
6969+ // {
7070+ // name: 'Mobile Chrome',
7171+ // use: {
7272+ // ...devices['Pixel 5'],
7373+ // },
7474+ // },
7575+ // {
7676+ // name: 'Mobile Safari',
7777+ // use: {
7878+ // ...devices['iPhone 12'],
7979+ // },
8080+ // },
8181+8282+ /* Test against branded browsers. */
8383+ // {
8484+ // name: 'Microsoft Edge',
8585+ // use: {
8686+ // channel: 'msedge',
8787+ // },
8888+ // },
8989+ // {
9090+ // name: 'Google Chrome',
9191+ // use: {
9292+ // channel: 'chrome',
9393+ // },
9494+ // },
9595+ ],
9696+9797+ /* Folder for test artifacts such as screenshots, videos, traces, etc. */
9898+ // outputDir: 'test-results/',
9999+100100+ /* Run your local dev server before starting the tests */
101101+ // webServer: {
102102+ // command: 'npm run start',
103103+ // port: 3000,
104104+ // },
105105+});
+9
footnotes_appview/end2end/tests/example.spec.ts
···11+import { test, expect } from "@playwright/test";
22+33+test("homepage has title and heading text", async ({ page }) => {
44+ await page.goto("http://localhost:3000/");
55+66+ await expect(page).toHaveTitle("Welcome to Leptos");
77+88+ await expect(page.locator("h1")).toHaveText("Welcome to Leptos!");
99+});
+109
footnotes_appview/end2end/tsconfig.json
···11+{
22+ "compilerOptions": {
33+ /* Visit https://aka.ms/tsconfig to read more about this file */
44+55+ /* Projects */
66+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
77+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
88+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
99+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
1010+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
1111+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212+1313+ /* Language and Environment */
1414+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616+ // "jsx": "preserve", /* Specify what JSX code is generated. */
1717+ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
1818+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
1919+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
2020+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
2121+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
2222+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
2323+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
2424+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
2525+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
2626+2727+ /* Modules */
2828+ "module": "commonjs", /* Specify what module code is generated. */
2929+ // "rootDir": "./", /* Specify the root folder within your source files. */
3030+ // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
3131+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
3232+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
3333+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
3434+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
3535+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
3636+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
3737+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
3838+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
3939+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
4040+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
4141+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
4242+ // "resolveJsonModule": true, /* Enable importing .json files. */
4343+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
4444+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
4545+4646+ /* JavaScript Support */
4747+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
4848+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
4949+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
5050+5151+ /* Emit */
5252+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
5353+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
5454+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
5555+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
5656+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
5757+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
5858+ // "outDir": "./", /* Specify an output folder for all emitted files. */
5959+ // "removeComments": true, /* Disable emitting comments. */
6060+ // "noEmit": true, /* Disable emitting files from a compilation. */
6161+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
6262+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
6363+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
6464+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
6565+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
6666+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
6767+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
6868+ // "newLine": "crlf", /* Set the newline character for emitting files. */
6969+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
7070+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
7171+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
7272+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
7373+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
7474+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
7575+7676+ /* Interop Constraints */
7777+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
7878+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
7979+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
8080+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
8181+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
8282+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
8383+8484+ /* Type Checking */
8585+ "strict": true, /* Enable all strict type-checking options. */
8686+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
8787+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
8888+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
8989+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
9090+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
9191+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
9292+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
9393+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
9494+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
9595+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
9696+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
9797+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
9898+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
9999+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
100100+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
101101+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102102+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103103+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104104+105105+ /* Completeness */
106106+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107107+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
108108+ }
109109+}
footnotes_appview/public/favicon.ico
This is a binary file and will not be displayed.
+61
footnotes_appview/src/app.rs
···11+use leptos::prelude::*;
22+use leptos_meta::{provide_meta_context, MetaTags, Stylesheet, Title};
33+use leptos_router::{
44+ components::{Route, Router, Routes},
55+ StaticSegment,
66+};
77+88+pub fn shell(options: LeptosOptions) -> impl IntoView {
99+ view! {
1010+ <!DOCTYPE html>
1111+ <html lang="en">
1212+ <head>
1313+ <meta charset="utf-8"/>
1414+ <meta name="viewport" content="width=device-width, initial-scale=1"/>
1515+ <AutoReload options=options.clone() />
1616+ <HydrationScripts options/>
1717+ <MetaTags/>
1818+ </head>
1919+ <body>
2020+ <App/>
2121+ </body>
2222+ </html>
2323+ }
2424+}
2525+2626+#[component]
2727+pub fn App() -> impl IntoView {
2828+ // Provides context that manages stylesheets, titles, meta tags, etc.
2929+ provide_meta_context();
3030+3131+ view! {
3232+ // injects a stylesheet into the document <head>
3333+ // id=leptos means cargo-leptos will hot-reload this stylesheet
3434+ <Stylesheet id="leptos" href="/pkg/footnotes_appview.css"/>
3535+3636+ // sets the document title
3737+ <Title text="Welcome to Leptos"/>
3838+3939+ // content for this welcome page
4040+ <Router>
4141+ <main>
4242+ <Routes fallback=|| "Page not found.".into_view()>
4343+ <Route path=StaticSegment("") view=HomePage/>
4444+ </Routes>
4545+ </main>
4646+ </Router>
4747+ }
4848+}
4949+5050+/// Renders the home page of your application.
5151+#[component]
5252+fn HomePage() -> impl IntoView {
5353+ // Creates a reactive value to update the button
5454+ let count = RwSignal::new(0);
5555+ let on_click = move |_| *count.write() += 1;
5656+5757+ view! {
5858+ <h1>"Welcome to Leptos!"</h1>
5959+ <button on:click=on_click>"Click Me: " {count}</button>
6060+ }
6161+}
+9
footnotes_appview/src/lib.rs
···11+pub mod app;
22+33+#[cfg(feature = "hydrate")]
44+#[wasm_bindgen::prelude::wasm_bindgen]
55+pub fn hydrate() {
66+ use crate::app::*;
77+ console_error_panic_hook::set_once();
88+ leptos::mount::hydrate_body(App);
99+}
+39
footnotes_appview/src/main.rs
···11+22+#[cfg(feature = "ssr")]
33+#[tokio::main]
44+async fn main() {
55+ use axum::Router;
66+ use leptos::logging::log;
77+ use leptos::prelude::*;
88+ use leptos_axum::{generate_route_list, LeptosRoutes};
99+ use footnotes_appview::app::*;
1010+1111+ let conf = get_configuration(None).unwrap();
1212+ let addr = conf.leptos_options.site_addr;
1313+ let leptos_options = conf.leptos_options;
1414+ // Generate the list of routes in your Leptos App
1515+ let routes = generate_route_list(App);
1616+1717+ let app = Router::new()
1818+ .leptos_routes(&leptos_options, routes, {
1919+ let leptos_options = leptos_options.clone();
2020+ move || shell(leptos_options.clone())
2121+ })
2222+ .fallback(leptos_axum::file_and_error_handler(shell))
2323+ .with_state(leptos_options);
2424+2525+ // run our app with hyper
2626+ // `axum::Server` is a re-export of `hyper::Server`
2727+ log!("listening on http://{}", &addr);
2828+ let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
2929+ axum::serve(listener, app.into_make_service())
3030+ .await
3131+ .unwrap();
3232+}
3333+3434+#[cfg(not(feature = "ssr"))]
3535+pub fn main() {
3636+ // no client-side main function
3737+ // unless we want this to work with e.g., Trunk for pure client-side testing
3838+ // see lib.rs for hydration function instead
3939+}