How can I implement CSRF with Ember Ajax or with Ember Data? - ember.js

I have an application in ember.js with golang but I don't know how to implement CSRF with Ember Ajax, I'm also using Ember Data but I don't know how to implement it with CSRF either, if you would be so kind as to provide me with an example or documentation on how to implement it, I would appreciate it.
I hope you can support me

Related

is it ok to use jquery inside ember controller or component

I wanted to follow ember js rules thoroughly.but I am novice to ember js so I am struggle to find ember standard way of doing coding.
Is it ok to do some jquery code inside ember component or controller ?
is it not good to use jquery inside there ?I think it not good to use jquery there.
You should try to minimise the usage of the jQuery in your Ember application unless that is a 3-rd party addon/library.
The reason to do so is that if you introduce jQuery to the application. You have to manually manage your application's state (sync all the state between different components for example).
Doing so you lost the biggest advantage of using a Front-end framework like Ember.JS.
My advice is to try to use computed property to change your application's behavior.

Ember Simple Auth intergration with djoser (django rest framework)

I would like to ask if it's a good practice to use ember simple auth library with djoser. I am using ember for frontend and I would like to use a certain backend made in django.
I was wondering if it's better to use ember simple auth library or to try to implement authentication from scratch. I just don't know in what level djoser implements login/logout actions.
Thanks in advance!
I consider a good practice to use ember simple auth with anything. It's a good and ready solution. Maybe you will need to implement authenticator and authorizer, but it's faster than writing and debugging the whole auth from the scratch.

Ember.js consuming REST Services

I have been working on a web app using .NET web forms. Now I'm trying to move to a Web API and a client side application. I'm trying to use Ember.js right now. I'm starting to get confused with Ember 2.0, Ember-Data and stuff.
My problem right now is that I'm trying to consume some of the REST services in order to show a list of things in my Ember app. Is it mandatory for me to use Ember-Data? If not, how can I consume the services to create, read, update and delete items (I mean, am I able to use only ajax or something)?
The Web API was built in order to be usable for many technologies. I need to build an specific URL for each request (even a simple GET has some mandatory parameters). That's why ember-data is not working well for me, at least not what I have learnt about it. Because this.store.find won't allow me to build the URL I need.
Greetings.
Is it mandatory for me to use Ember-Data?
No, it's not. You can use other libraries such as Ember RESTless, or write your own.
You can even use simple jQuery AJAX calls whenever you need to fire a request to your API, however, you'll loose many benefits of Ember Data, such as lazy, asynchronous loading of models when they are needed.
That's why ember-data is not working well for me, at least not what I
have learnt about it. Because this.store.find won't allow me to build
the URL I need.
You can override buildURL method of adapter you're using(for example RESTAdapter), source code on GitHub could be helpful if you would like to do that, and you can find everything you need to create your own behavior for buildURL method in Ember API documentation.

How to check email existence using emberjs email-existence?

Ember does give a link for email-existence.
But can somebody please explain how to use this API for checking an email whether it exists?
https://github.com/nmanousos/email-existence
Actually it doesn't have much to do with Ember in the beginning. You have to create a node.js application and install email-existence package, then, you have to expose an API for Ember and send a request from client application to your backend.

Should I use ember data with ember.js?

In the project I am working on, we are using ember.js (1.0rc1) without ember-data which is working out quite fine so far. The reason why we decided to go without ember-data is that we already have some utility methods to handle the integration with the REST interface, and over all because ember-data is not part of the ember.js.
From emberjs.com:
Currently, Ember Data ships as a separate library from Ember.js, while
we expand the adapter API to support more features. The API described
in this section tends to be stable, however. Until Ember Data is
included as part of the standard distribution, you can get your copy
from the GitHub page.
So, to my questions and the input I am looking for:
how much do we lose/gain with this approach? (besides the REST integration)
experiences of somebody that actually might have started also without ember-data, and now migrated to ember-data
maturity of ember-data and its integration into ember.js
And there is another question, which might rather be for the ember.js/ember-data devs:
what's the roadmap to integrate ember-data into ember.js and how strong will be the impact on the APIs?
Thanks for sharing your experiences and giving some hints and advices. // ph
I use ember-data in my project and I'm very pleased with it. I saves you a lot of time developing your own stuff for communicating with the server.
At this time ember-data is not officially production-ready but I use it already.
Read this on the emberjs website about ember-data. It says:
Without any configuration, Ember Data can load and save records and relationships served via a RESTful JSON API, provided it follows certain conventions.
We also understand that there exist many web service APIs in the world, many of them crazy, inconsistent, and out of your control. Ember Data is designed to be configurable to work with whatever persistence layer you want, from the ordinary to the exotic.
There is more information on the github page. There is even kind of a roadmap in it...
Another advantage is that you can define your Models with their relationships. It's also possible to use transactions which are giving you the ability to rollback changes if something went wrong at the server.
I really like the vision behind ember-data that it's not dependent on the kind of backend you use. Or where you define your relationships. If you use Mongo-db where you define the relationships on the parent object, where others do that the childs.