如何将ember应用程序集成到json服务器中使用

How can ember application be integrated to use with json-server?

本文关键字:服务器 json 集成 ember 应用程序      更新时间:2023-09-26

我刚开始使用ember.js。我已经开始使用json服务器作为数据服务器开发一个基本的RESTful应用程序。

在查阅了大量文档后,ember似乎已经从服务器标准化了JSON响应格式的格式,并且本身与"JSON服务器"不兼容。

有没有可能在余烬方面处理这个问题?

Ember版本:1.13

这是我当前的错误日志:

ember.debug.js:30195 Error while processing route: tasks.index Assertion Failed: normalizeResponse must return a valid JSON API document:
* One or more of the following keys must be present: "data", "errors", "meta". Error: Assertion Failed: normalizeResponse must return a valid JSON API document:
* One or more of the following keys must be present: "data", "errors", "meta".
at new Error (native)

将其放入app/serializers/application.js

import DS from 'ember-data';
export default DS.JSONSerializer;