简体   繁体   中英

How do I connect my postgresDB to Ionic?

How do I connect my postgresDB to Ionic??? I've been stuck on this for awhile. I tried looking in the docs, for videos or tutorials, but i can't find what i'm looking for.

when starting a new ionic app

  1. where do I put my models?
  2. Does it matter where I put my Config files for my database?

I am looking for a step by step on how to connect my postgresDB to my Ionic project?

The thing is; you can't connect Ionic to Postgres directly. No, there's no workaround, no magic involved, it's just not the way this is supposed to work. Ionic works on top of Angular and Angular is a frontend framework.

However, the way you should do it is that you basically create a (RESTful) API on your server side.

Most likely this will be made with PHP which will talk directly to Postgres and query it.

After you write your (RESTful) API then you can consume it through your services in Angular by using Angular's $resource object.

Sure, this is not a step by step answer, and it seems you're just starting in this area, so you have some learning to do on your part (REST, RESTful, $resource, services...), but I wish you good luck and if you'll have any more specific questions, don't hesitate to ask them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM