And with PostgREST [0], you can automatically convert any PostGIS table (with geometry or geography column) to GeoJSON by using an "Accept: application/geo+json" header in the request.
[0] https://docs.postgrest.org/en/v14/how-tos/working-with-postg...