-
-
Notifications
You must be signed in to change notification settings - Fork 295
/
Copy pathconfig.toml
193 lines (159 loc) · 5.86 KB
/
config.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# 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
# 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
❯ Shuttle
❯ 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"]
```
'''