Reputation: 6572
I'm having trouble understanding how to connect Ember.js with PostgreSQL using Ember Data adapter.
My main problem is finding a complete example where I can study how I would do this.
I know I have to create a jsonapi to provide the data. My goal is using Node.js to provide the data. I've found this project here and I see that it has a relational db store.
Anyone knows where I can find a complete example of a project using Ember with a PostgreSQL jsonapi server implemented in Node.js?
Preferably a simple project where I can understand the basics of getting a connection running and show the data in Ember.
Any help appreciated. :)
Upvotes: 0
Views: 1413
Reputation: 627
I've written a boilerplate node app and a boilerplate ember app that are designed to work together as a frontend/backend app. They aren't especially simple, but if you explore them you might be able to gain some good insight into how these two frameworks can connect.
For example, in the users controller, the show method maps to /users/:id, and then responds with a custom JSON payload conforming to JSON API spec. Although it hasn't been implemented yet, in Ember simply having this.store.findRecord('user', 1)
will automatically send a request to /users/1.
You can explore the config files to look at the postgres connection (I implemented using bookshelf and knex).
Hope that helps!
Upvotes: 1
Reputation: 2539
You actually have two questions here. You first need to choose how nodejs communicates with your ember-data. This is a possible approach. It also provides a connector to your database. Secondly, you need to define how nodejs communicates with the db. Here is a list of possible packages that might fit your needs.
Upvotes: 0