https://github.com/mdecker-mobilecomputing/ionic_zitatevonsupabase
Ionic/Angular-App, die mit Capacitor-HTTP Zitate von einer auf Supabase gehosteten REST-API abruft
https://github.com/mdecker-mobilecomputing/ionic_zitatevonsupabase
angular github-actions ionic-framework supabase
Last synced: 5 days ago
JSON representation
Ionic/Angular-App, die mit Capacitor-HTTP Zitate von einer auf Supabase gehosteten REST-API abruft
- Host: GitHub
- URL: https://github.com/mdecker-mobilecomputing/ionic_zitatevonsupabase
- Owner: MDecker-MobileComputing
- License: bsd-3-clause
- Created: 2026-06-07T16:00:00.000Z (6 days ago)
- Default Branch: master
- Last Pushed: 2026-06-07T17:27:12.000Z (6 days ago)
- Last Synced: 2026-06-07T18:22:20.620Z (6 days ago)
- Topics: angular, github-actions, ionic-framework, supabase
- Language: TypeScript
- Homepage:
- Size: 162 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Ionic-App "Zitate von Supabase" #
Dieses Repo enthält das Quellcode-Projekt für eine einfache Ionic/Angular-App,
die mit [CapacitorHttp](https://capacitorjs.com/docs/apis/http) von einer auf
[Supabase](https://supabase.com/) gehosteten REST-API zufällig ausgewählte
Zitate abruft.

----
## Backend auf Supabase einrichten ##
Die folgende SQL-Befehle sind auf der Web-Oberfläche im "SQL Editor" auszuführen
(alle Befehle können mit *einem* Klick auf den "Run"-Button auf einmal ausgeführt werden).
```
-- 1) Tabelle anlegen
CREATE TABLE IF NOT EXISTS public.zitate (
id SERIAL PRIMARY KEY,
zitat TEXT NOT NULL,
autor TEXT NOT NULL
);
-- 2) Optional: Beispiel-Daten
INSERT INTO public.zitate (zitat, autor)
VALUES
('Talk is cheap. Show me the code.', 'Linus Torvalds'),
('Programs must be written for people to read, and only incidentally for machines to execute.', 'Harold Abelson'),
('Simplicity is prerequisite for reliability.', 'Edsger W. Dijkstra')
ON CONFLICT DO NOTHING;
-- 3) Sicherstellen, dass "Row Level Security" (RLS) eingeschaltet ist
ALTER TABLE public.zitate ENABLE ROW LEVEL SECURITY;
-- 4) Funktion anlegen:
-- SECURITY DEFINER, damit die Funktion mit den Rechten des Owners läuft
-- SET search_path = '' laut Supabase-Empfehlung
CREATE OR REPLACE FUNCTION public.get_zufaelliges_zitat()
RETURNS TABLE(zitat TEXT, autor TEXT)
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = ''
AS $$
BEGIN
RETURN QUERY
SELECT z.zitat, z.autor
FROM public.zitate z
ORDER BY RANDOM()
LIMIT 1;
END;
$$;
-- 5) Direkte Rechte auf die Tabelle für anon entziehen
REVOKE ALL ON TABLE public.zitate FROM anon;
REVOKE ALL ON TABLE public.zitate FROM authenticated;
```
----
## License ##
See the [LICENSE file](LICENSE.md) for license rights and limitations (BSD 3-Clause License) for the files in this repository.