195 lines
5.9 KiB
TOML
195 lines
5.9 KiB
TOML
# The URL the site will be built for
|
||
base_url = "https://loco.rs"
|
||
title = "Loco.rs - Productivity-first Rust Fullstack Web Framework"
|
||
description = "Loco.rs is like Ruby on Rails for Rust. Use it to quickly build and deploy Rust based apps from zero to production."
|
||
|
||
|
||
# Whether to automatically compile all Sass files in the sass directory
|
||
compile_sass = true
|
||
|
||
# Whether to generate a feed file for the site
|
||
generate_feeds = true
|
||
|
||
feed_filenames = ["blog/atom.xml", "blog/rss.xml"]
|
||
|
||
# When set to "true", the generated HTML files are minified.
|
||
minify_html = false
|
||
|
||
# The taxonomies to be rendered for the site and their configuration.
|
||
taxonomies = [
|
||
{ name = "authors" }, # Basic definition: no feed or pagination
|
||
]
|
||
|
||
|
||
# Whether to build a search index to be used later on by a JavaScript library
|
||
build_search_index = true
|
||
|
||
[markdown]
|
||
# Whether to do syntax highlighting
|
||
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
|
||
highlight_theme = "css"
|
||
highlight_code = true
|
||
highlight_themes_css = [
|
||
{ theme = "OneHalfDark", filename = "syntax-theme-dark.css" },
|
||
{ theme = "OneHalfLight", filename = "syntax-theme-light.css" },
|
||
]
|
||
[extra]
|
||
# Put all your custom variables here
|
||
|
||
# Menu items
|
||
[[extra.menu.main]]
|
||
name = "Docs"
|
||
section = "docs"
|
||
url = "/docs/getting-started/tour/"
|
||
weight = 10
|
||
|
||
[[extra.menu.main]]
|
||
name = "Blog"
|
||
section = "blog"
|
||
url = "/blog/"
|
||
weight = 20
|
||
|
||
[[extra.menu.main]]
|
||
name = "Casts"
|
||
section = "casts"
|
||
url = "/casts/"
|
||
|
||
[[extra.menu.social]]
|
||
name = "Twitter"
|
||
pre = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-twitter"><path d="M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z"></path></svg>'
|
||
url = "https://twitter.com/jondot"
|
||
weight = 10
|
||
|
||
[[extra.menu.social]]
|
||
name = "GitHub"
|
||
pre = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-github"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path></svg>'
|
||
url = "https://github.com/loco-rs/loco"
|
||
post = "v0.1.0"
|
||
weight = 20
|
||
|
||
|
||
[[extra.homepage.features]]
|
||
name = "Models"
|
||
description = 'Model your business with rich entities and avoid writing SQL, backed by SeaORM. Build relations, validation and custom logic on your entities for the best maintainability.'
|
||
example = '''```rust
|
||
impl Model {
|
||
pub async fn find_by_email(db: &DatabaseConnection, email: &str)
|
||
-> ModelResult<Self> {
|
||
|
||
Users::find()
|
||
.filter(eq(Column::Email, email))
|
||
.one(db).await?
|
||
.ok_or_else(|| ModelError::EntityNotFound)
|
||
}
|
||
|
||
pub async fn create_report(&self, ctx: &AppContext) -> Result<()> {
|
||
ReportWorker::perform_later(
|
||
&ctx,
|
||
ReportArgs{ user_id: self.id }
|
||
).await?;
|
||
}
|
||
}
|
||
```
|
||
'''
|
||
|
||
[[extra.homepage.features]]
|
||
name = "Controllers"
|
||
description = 'Handle Web requests parameters, body, validation, and render a response that is content-aware. We use Axum for the best performance, simplicity and extensibility.'
|
||
example = '''```rust
|
||
pub async fn get_one(
|
||
respond_to: RespondTo,
|
||
Path(id): Path<i32>,
|
||
State(ctx): State<AppContext>,
|
||
) -> Result<Response> {
|
||
let item = Notes::find_by_id(id).one(&ctx.db).await?;
|
||
match respond_to {
|
||
RespondTo::Html => html_view(&item),
|
||
_ => format::json(item),
|
||
}
|
||
}
|
||
|
||
pub fn routes() -> Routes {
|
||
Routes::new()
|
||
.prefix("notes")
|
||
.add("/{id}", get(get_one))
|
||
}
|
||
```
|
||
'''
|
||
|
||
[[extra.homepage.features]]
|
||
name = "Views"
|
||
description = 'Use server-rendered templates with Tera or JSON. Loco can render views on the server or work with a frontend app seamlessly. Configure your fullstack set up any way you like.'
|
||
example = '''```rust
|
||
|
||
// Literals
|
||
format::text("Loco")
|
||
|
||
// Tera view engine
|
||
format::render().view(v, "home/hello.html", json!({}))
|
||
|
||
// strongly typed JSON responsed, backed by `serde`
|
||
format::json(Health { ok: true })
|
||
|
||
// Etags, cookies, and more
|
||
format::render().etag("loco-etag")?.empty()
|
||
|
||
```
|
||
'''
|
||
|
||
[[extra.homepage.features]]
|
||
name = "Background Jobs"
|
||
description = 'Perform compute or I/O intensive jobs in the background with a Redis backed queue, or with threads. Implementing a worker is as simple as implementing a <code>perform</code> function for the <code>Worker</code> trait.'
|
||
example = '''```rust
|
||
impl worker::Worker<DownloadArgs> for UsersReportWorker {
|
||
async fn perform(&self, args: DownloadArgs) -> worker::Result<()> {
|
||
let all = Users::find()
|
||
.all(&self.ctx.db)
|
||
.await
|
||
.map_err(Box::from)?;
|
||
for user in &all {
|
||
println!("user: {}", user.id);
|
||
}
|
||
Ok(())
|
||
}
|
||
}
|
||
|
||
```
|
||
'''
|
||
|
||
[[extra.homepage.features]]
|
||
name = "Deployment"
|
||
description = 'Easily generate deployment configurations with a guided CLI interface. Select from deployment options for tailored deployment setups.'
|
||
example = '''```sh
|
||
|
||
$ cargo loco generate deployment
|
||
? ❯ Choose your deployment ›
|
||
❯ Docker
|
||
❯ Nginx
|
||
|
||
..
|
||
✔ ❯ Choose your deployment · Docker
|
||
skipped (exists): "Dockerfile"
|
||
added: ".dockerignore"
|
||
|
||
```
|
||
'''
|
||
|
||
[[extra.homepage.features]]
|
||
name = "Scheduler"
|
||
description = 'Simplifies the traditional, often cumbersome crontab system, making it easier and more elegant to schedule tasks or shell scripts.'
|
||
example = '''```yaml
|
||
jobs:
|
||
db_vaccum:
|
||
run: "db_vaccum.sh"
|
||
shell: true
|
||
schedule: "0 0 * * *"
|
||
tags: ["maintenance"]
|
||
|
||
send_birthday:
|
||
run: "user_birthday_task"
|
||
schedule: "Run every 2 hours"
|
||
tags: ["marketing"]
|
||
|
||
```
|
||
'''
|