Skip to content

Commit

Permalink
saas: better starter experience, user should pick UI serving scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
jondot committed Aug 19, 2024
1 parent 051071a commit 25fda8b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
6 changes: 6 additions & 0 deletions starters/saas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Loco is a web and API framework running on Rust.

This is the **SaaS starter** which includes a `User` model and authentication based on JWT.
It also include configuration sections that help you pick either a frontend or a server-side template set up for your fullstack server.


## Quick Start
Expand Down Expand Up @@ -48,6 +49,11 @@ controller/app_routes.rs:203: [Middleware] Adding log trace id
started on port 5150
```

## Full Stack Serving

You can check your [configuration](config/development.yaml) to pick either frontend setup or server-side rendered template, and activate the relevant configuration sections.


## Getting help

Check out [a quick tour](https://loco.rs/docs/getting-started/tour/) or [the complete guide](https://loco.rs/docs/getting-started/guide/).
45 changes: 35 additions & 10 deletions starters/saas/config/development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,25 @@ server:
# - POST
# Set the value of the [`Access-Control-Max-Age`][mdn] header in seconds
# max_age: 3600


# server-side static assets config
# #############################################
# Full stack SaaS asset serving
# #############################################
#
# You can choose from:
#
# (1) Server-side rendered templates (like erb in Ruby, ejs in nodejs) based on the Tera templating engine.
# (2) Client-side frontend set up
#
# You can also choose both.
#
# Uncomment the relevant sections below:

#
# (1) Server-side static assets config
# ====================================
#
# for use with the view_engine in initializers/view_engine.rs
#
# static:
Expand All @@ -87,15 +104,23 @@ server:
# path: "assets/static"
# fallback: "assets/static/404.html"

# client side app static config
static:
enable: true
must_exist: true
precompressed: false
folder:
uri: "/"
path: "frontend/dist"
fallback: "frontend/dist/index.html"
#
# (2) Client side app static config
# =================================
#
# Note that you need to go in `frontend` and run your frontend build first,
# e.g.: $ npm install & npm build
#
# static:
# enable: true
# must_exist: true
# precompressed: false
# folder:
# uri: "/"
# path: "frontend/dist"
# fallback: "frontend/dist/index.html"
#


# Worker Configuration
workers:
Expand Down

0 comments on commit 25fda8b

Please sign in to comment.