my server is working on the port :3000 and i am using node, express on server side and this is working fine while using curl or REST client.
ember cli server is working on port :4200
I added this code on environment.js for connecting server to client.
contentSecurityPolicy: {
'default-src': "'none'",
'script-src': "'self' 'unsafe-inline' 'unsafe-eval'",
'font-src': "'self'",
'connect-src': "'self' http://localhost:3000",
'img-src': "'self'",
'report-uri':"'localhost'",
'style-src': "'self' 'unsafe-inline'",
'frame-src': "'none'"
}
and my application adapter code is:
import JSONAPIAdapter from 'ember-data/adapters/json-api';
export default JSONAPIAdapter.extend({
"host": "http://localhost:3000",
"namespace": "api"
});
running my ember server on this way ember server --proxy http://127.0.0.1:3000 on controller i use ajax call :
$.ajax({
type: 'POST',
url: '/blog',
contentType: 'application/json',
data: param,
processData: false,
success :
});
it getting an error: POST http://localhost:4200/blog 500 (Internal Server Error)
i have done all these but i don't know why it's not working. please help me if you have any idea for that .
Aucun commentaire:
Enregistrer un commentaire