fastn
With Django .... or other backends.
If your backend is written in Python/Django, Ruby On Rails, Java, Go etc, you can usefastn
to power the frontend of your application.fastn
in
static site mode, then how the page looked when fastn build
was
called will be shown to everyone. But if you are using dynamic
mode then this page would be regenerated on every page load.fastn
In The Frontfastn
is being designed to be in the front of you backend application. The
request from users browser first reach fastn
, and is then either handled by
fastn
itself, say if it was for a static file, or for a route implemented by
the fastn project
.fastn
acts as a proxy pass if you configure it like this:-- import: fastn
-- fastn.package: hello
endpoint: https://127.0.0.1:8000
endpoint
tells you where the upstream server is. If fastn
can not serve
an incoming request based on the content of the fastn
package, it will proxy
the request to the provided endpoint
.If your fastn package needs some data, direct SQL access does not work for you, you can use HTTP processor to make HTTP request to your backend, fetch data from your fastn document.
This API call happens from server side, during the initial page generation.If you want to call an API implemented in your backend, eg
https://127.0.0.1:8080/api/get-user
if you have configured the endpoint
,
to https://127.0.0.1:8080/
, and your application is running on example.com
,
served by fastn serve
, you can make an API request to example.com/api/get-user
,
and the request will go to fastn
first, and fastn
will forward the request
to your backend, and return the response returned by backend to the browser.
fastn
acting as router, Nginx like proxy
is not needed when doing local development.