Hi! I am new to ember. I have lot of doubts on ember data like how to connect the database to ember and how to run the code with database. is it necessary to run any back end servers with ember server for working with back end.
Hi @Santhoshi, hopefully I can help clear things up for you. Ember is a front-end framework only, and the
ember serve command is meant only for development purposes. AFAIK any modern front-end framework will work like this, meaning it will require some sort of API or backend layer. Ember is not a framework intended for developing server-side code. It is, however, highly customizable so you can fit it onto whatever backend you need.
A production ember app will essentially require two servers, or at least a server that serves two different things:
- the Ember app itself (an html file, some js, css files and assets)
- the API endpoints that the Ember app uses for data
So the ‘ember serve’ command is meant only to fulfill item 1 above, and only for development purposes. To connect a database you’d either want to write your own server API or use something like Firebase or maybe PouchDB (@broerse could probably tell you more about that).
When you actually deploy a production ember app you would typically deploy to a static file service like Amazon S3 or use any other standard webserver with configuration for service a webapp, but again you would never use
ember serve in production. It is merely a convenience for serving the webapp locally during development.
@dknutsen Thanks! @Santhoshi Yes https://github.com/pouchdb-community/ember-pouch will let you talk to an in browser PouchDB server. This server can be synced with a CouchDB server like IBM cloudant or your own CouchDB. For testing you can just run PouchDB without a server. The Ember App can be deployed to the CouchDB database so you don’t need a web server. https://bloggr.exmer.com is deployed to a CouchDB server this way. (We are in the process of switching from martinic.cloudant.com to martinic.couchcluster.com so it can break in the next week)
Source for Bloggr Example https://github.com/broerse/ember-cli-blog
Hi @Santhoshi, in order to manage the data you want to save you’ll need to use a backend framework like rails, phoenix or nodejs. These will let you save the information from the ember app to the database.
GoRails have a series which should walk you through this process. You can find it here.
Hi @James-Byrne, I already installed nodejs framework but i don’t know how to connect the database.
Ahh sorry @Santhoshi, in that case heres a tutorial on connecting a node app to a mysql db.
@James-Byrne Thanks, can you provide tutorial on simple user login system using ember-php-my sql with REST adapters.
Hi!.. Im working on my ember training project where it is a login form… I need to use java servelts to get the input text field from the login form(username,password)and store it in mysql database. How to get the input values to servlets program
Hello and welcome Generally with login forms you will need to post your data (using fetch or another Ajax library) to an endpoint that your Java pages expose. Your Java code will then save the data to your MySQL database. Does that help?