O
O
Oleg Petrov2018-11-21 14:04:01
Angular
Oleg Petrov, 2018-11-21 14:04:01

How to load data from Postgres into the client on Angular 1.7?

I have an Angular client written in Typescript.
I want to use data from my PostgreSQL.
I was told that this can't be done without a server, more precisely, it's possible, but only using a NoSQL database, such as MongoDB, communicating with it using http Requests or using the flask_pymongo library.
Are there no more options?
Do not offer a service for returning data to the client, I still won’t be able to write it normally because of my little experience.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eldar Amantai, 2018-11-22
@steppefox

If it is very short - out of the box and quickly it is impossible. Why?
On the client (Angular) you need to send HTTP/Ajax requests to your database somewhere. Out of the box, PostgreSQL does not support any REST Api. To do this, you need to configure it or install additional wrappers / programs so that they provide this HTTP API for you. For example here https://github.com/PostgREST/postgrest
I can also advise you to look towards Firebase https://firebase.google.com/,it is just made for client applications (mobile and web) that do not have a backend. Firebase will give you some kind of database and additional services. Well, they have a Free plan sufficient for development. And if you abstract the requests to Firebase correctly, then after spending a couple of days you can rewrite everything to the normal Rest API if you suddenly have a normal backend.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question