Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the use case for using an HTML template engine in Postgres? #1

Open
uvulpos opened this issue Feb 7, 2024 · 1 comment
Open

Comments

@uvulpos
Copy link

uvulpos commented Feb 7, 2024

Serious question! What is the use case for this? I cannot come up with a perspective, but I'm curious what brought you to the conclusion that this is a useful project / extension?

@f-prime
Copy link
Owner

f-prime commented Feb 7, 2024

You have to change your perspective on what Postgres is. If you just see it as a place to store your application data, then yeah it’s confusing. Especially when you hide the database behind an ORM.

It is much more than that though. It is a complete self contained ecosystem for building applications. When used in tandem with a tool like PostgREST or Omnigres, you can completely eliminate the need for any sort of custom middle layer (e.g. an express app, flask app, etc that serves your API routes). Which usually just act as a proxy layer between the database and the client anyway. You instead express your endpoints as schemas and stored procedures. PostgREST handles the creates of these endpoints for you. You end up with something akin to GraphQL (but not actually gql).

This presents a problem though. What if you don’t want to write a separate frontend codebase in React or Angular or something? What if, instead, you want to serve HTML directly? Traditionally you’d use a template rendering library that comes with your favorite framework. Jinja, Mustache, Pug, etc. But those require that middle layer that we have eliminated.

That’s where PGTera comes in. It gives you the power to serve those HTML templates directly from this PostREST or Omnigres ecosystem.

It may seem strange at first, but it’s actually a far better way do web development in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants