leptos-rs / start-aws Goto Github PK
View Code? Open in Web Editor NEWStarter template for use with the Leptos web framework, Axum, and AWS.
License: MIT License
Starter template for use with the Leptos web framework, Axum, and AWS.
License: MIT License
Hi there!
I have been using leptos
for a personal project at Amazon, trying at the same time to get a better grasp of Web development in Rust. So far, local development has been great, loved having cargo-leptos
for hot-reloading and more.
Once I had something quick locally (just a main page), wanted to move to deploy it in a Lambda, and I was able to do so, by using cargo-leptos
and cargo-lambda
with the example start-aws
. No issue there. The question comes around understanding what are the routes being defined when deployed this way.
When running cargo leptos watch
, my localhost on the main path shows the HomePage and I would expect it to be the same way when deploying to Lambda. To avoid the XY Problem:
I have a Route53 domain connected to an API Gateway that connects to the Lambda I deployed with my Leptos code base. When contacting the Route53 domain (also tested the API Gateway directly), I see that the Lambda is invoked, but it returns an 404 page.
<script type="module">
function idle(c) {
if ("requestIdleCallback" in window) {
window.requestIdleCallback(c);
} else {
c();
}
}
idle(() => {
import('/pkg/amzn-gota-a-gota.js')
.then(mod => {
mod.default('/pkg/amzn-gota-a-gota.wasm').then(() => mod.hydrate());
})
});
</script>
</head><body><!--hk=0-0-0-4--><!--hk=0-0-0-6--><!--hk=0-0-0-8--><!--hk=0-0-0-9--><main data-hk="0-0-0-12"><h1 data-hk="0-0-0-18">Error</h1><h2 data-hk="0-0-0-21">404 Not Found</h2><p data-hk="0-0-0-22">Error: Not Found</p><!--hk=0-0-0-20--><!--hk=0-0-0-23--><!--hk=0-0-0-19--><!--hk=0-0-0-17--><!--hk=0-0-0-16--><!--hk=0-0-0-15--><!--hk=0-0-0-13--></main><!--hk=0-0-0-11--><!--hk=0-0-0-10--><!--hk=0-0-0-2--><!--hk=0-0-0-1--><script>__LEPTOS_PENDING_RESOURCES = [];__LEPTOS_RESOLVED_RESOURCES = new Map();__LEPTOS_RESOURCE_RESOLVERS = new Map();__LEPTOS_LOCAL_ONLY = [];</script></body></html>
Following that set up, I thought that Leptos would set up the "" route to be pointing to the HomePage (haven't modified that, it's part of the start-aws
example), hence the connection directly with a GET
method to the root method would return that page.
Any guidance / pointers? I'll keep investigating whether the API Gateway is changing the method to contact the Lambda.
Have a duplicate discussion on the main repo, but I thought cross-posting here where probably @CorvusPrudens could help might be more productive! leptos-rs/leptos#2159
Thanks so much!
There's a small issue with the README.md in its current form - following the instructions uses the generic Leptos Axum starter template instead of this repo.
Update the repo instructions to ensure users clone this repo instead.
The readme should use:
cargo generate --git https://github.com/leptos-rs/start-aws.git
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.