0
nginxのローカルページとgithubページで動作します。 nginxでも、ブラウザからjsonファイルを正しく取得できます.nginxのemberアプリケーション内にはありません。のみnginxの上でこのエラーにNginxがEmber.js経由でファイルを入手できない
export default Ember.Route.extend({
model: function() {
return $.getJSON('data/contributors.json')
}
})
結果:
server.js:76 Mirage: Your Ember app tried to GET 'data/contributors.json', but there was no route defined to handle this request. Define a route that matches this path in your mirage/config.js file. Did you forget to add your namespace?
nginxの上の場所の設定:
location/{
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
try_files $uri /index.html;
}
location /data {
try_files $uri /contributors.json
}
設定/ environment.js
if (environment === 'internal') {
ENV.baseURL = '/'
ENV['ember-cli-mirage'] = {
enabled: true
}
ENV.mirageNamespace = '<ip address>'
ENV.isProd = true
ENV.isDemo = true
}
エラーを解決するための助けがあれば幸いです。
私はこれを持っているが、それは動作しません。しかし、私が 'ember build'をやっただけでは、Nginxサーバは動作します...(私もenvironment.jsファイルを質問に追加しました) – Hillboy
あなたのAPI/Emberデータアダプタのホストは、emberアプリケーションを提供しているドメイン以外に指定されていますか? ?もしそうなら、 'パススルー 'の呼び出しでそのドメインを指定する必要があります。 'this.passthrough( 'my.api.com/**')' –