🚧 Doc and code tweaks

This commit is contained in:
Manuel Cillero 2024-02-27 17:51:09 +01:00
parent 812d5d0506
commit cb38145bf5
2 changed files with 38 additions and 13 deletions

View file

@ -23,6 +23,35 @@ crates to provide extensible and easily configurable features.
frequent changes. Production use is not recommended until version **0.1.0**. frequent changes. Production use is not recommended until version **0.1.0**.
# ⚡️ Quick start
```rust
use pagetop::prelude::*;
struct HelloWorld;
impl PackageTrait for HelloWorld {
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
scfg.route("/", service::web::get().to(hello_world));
}
}
async fn hello_world(request: service::HttpRequest) -> ResultPage<Markup, ErrorPage> {
Page::new(request)
.with_component(Html::with(html! { h1 { "Hello World!" } }))
.render()
}
#[pagetop::main]
async fn main() -> std::io::Result<()> {
Application::prepare(&HelloWorld).run()?.await
}
```
This program features a `HelloWorld` package, providing a service that serves a greeting web page
accessible via `http://localhost:8088` under default settings.
# 📂 Repository Structure # 📂 Repository Structure
This repository is organized into a workspace that includes several subprojects, each serving a This repository is organized into a workspace that includes several subprojects, each serving a
@ -35,6 +64,14 @@ distinct role within the PageTop ecosystem:
and maintenance of dynamic, fast, and secure websites. It uses the following essential packages to and maintenance of dynamic, fast, and secure websites. It uses the following essential packages to
provide standard CMS functionalities. provide standard CMS functionalities.
## Helpers
* [pagetop-macros](https://github.com/manuelcillero/pagetop/tree/main/helpers/pagetop-macros):
A collection of procedural macros that enhance the development experience within PageTop.
* [pagetop-build](https://github.com/manuelcillero/pagetop/tree/main/helpers/pagetop-build):
Simplifies the process of embedding resources directly into binary files for PageTop applications.
## Packages ## Packages
* [pagetop-user](https://github.com/manuelcillero/pagetop/tree/main/packages/pagetop-user): * [pagetop-user](https://github.com/manuelcillero/pagetop/tree/main/packages/pagetop-user):
@ -56,14 +93,6 @@ distinct role within the PageTop ecosystem:
* [pagetop-bulmix](https://github.com/manuelcillero/pagetop/tree/main/packages/pagetop-bulmix): * [pagetop-bulmix](https://github.com/manuelcillero/pagetop/tree/main/packages/pagetop-bulmix):
Utilizes the *[Bulma](https://bulma.io/)* framework for sleek, responsive design elements. Utilizes the *[Bulma](https://bulma.io/)* framework for sleek, responsive design elements.
## Helpers
* [pagetop-macros](https://github.com/manuelcillero/pagetop/tree/main/helpers/pagetop-macros):
A collection of procedural macros that enhance the development experience within PageTop.
* [pagetop-build](https://github.com/manuelcillero/pagetop/tree/main/helpers/pagetop-build):
Simplifies the process of embedding resources directly into binary files for PageTop applications.
# 📜 License # 📜 License

View file

@ -67,11 +67,7 @@ where
fn collect(&self) -> Result<HashMap<String, Value>> { fn collect(&self) -> Result<HashMap<String, Value>> {
// Coerce the file contents to a string. // Coerce the file contents to a string.
let (uri, contents) = match self let (uri, contents) = match self.source.resolve().map_err(ConfigError::Foreign) {
.source
.resolve()
.map_err(ConfigError::Foreign)
{
Ok((uri, contents)) => (uri, contents), Ok((uri, contents)) => (uri, contents),
Err(error) => { Err(error) => {