親 Express アプリと子アプリとして Ghost アプリがあり、ここでは Ghost を npm モジュールとして使用しています。
でレンダリングされるように Ghost をルーティングしましたhttp://localhost:9000/blog
。すべての構成は正常に機能します (基本構成が正しく提供されていない場合、Ghost はエラーをスローします)。
これが私のGhostスタートアップコードです
ghost({
config: path.join(__dirname, '/config/ghost.config.js')
}).then(function (ghostServer) {
app.use(ghostServer.config.paths.subdir, ghostServer.rootApp);
ghostServer.start(app);
});
ここに私のゴースト設定があります
// # Ghost Configuration
// Setup your Ghost install for various [environments](http://support.ghost.org/config/#about-environments).
// Ghost runs in `development` mode by default. Full documentation can be found at http://support.ghost.org/config/
var path = require('path'),
config;
config = {
// ### Production
// When running Ghost in the wild, use the production environment.
// Configure your URL and mail settings here
production: {
url: 'http://my-ghost-blog.com',
mail: {},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},
server: {
host: '127.0.0.1',
port: '2368'
}
},
// ### Development **(default)**
development: {
// The url to use when providing links to the site, E.g. in RSS and email.
// Change this to your Ghost blog's published URL.
url: 'http://localhost:9000/blog/',
// Example mail config
// Visit http://support.ghost.org/mail for instructions
// ```
// mail: {
// transport: 'SMTP',
// options: {
// service: 'Mailgun',
// auth: {
// user: '', // mailgun username
// pass: '' // mailgun password
// }
// }
// },
// ```
// #### Database
// Ghost supports sqlite3 (default), MySQL & PostgreSQL
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '../blog/data/ghost-dev.db')
},
debug: false
},
// #### Server
// Can be host & port (default), or socket
server: {
// Host to be passed to node's `net.Server#listen()`
host: '127.0.0.1',
// Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
port: '9000'
},
// #### Paths
// Specify where your content directory lives
paths: {
contentPath: path.join(__dirname, '../blog/')
}
},
// **Developers only need to edit below here**
// ### Testing
// Used when developing Ghost to run tests and check the health of Ghost
// Uses a different port number
testing: {
url: 'http://127.0.0.1:2369',
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost-test.db')
}
},
server: {
host: '127.0.0.1',
port: '2369'
},
logging: false
},
// ### Testing MySQL
// Used by Travis - Automated testing run through GitHub
'testing-mysql': {
url: 'http://127.0.0.1:2369',
database: {
client: 'mysql',
connection: {
host : '127.0.0.1',
user : 'root',
password : '',
database : 'ghost_testing',
charset : 'utf8'
}
},
server: {
host: '127.0.0.1',
port: '2369'
},
logging: false
},
// ### Testing pg
// Used by Travis - Automated testing run through GitHub
'testing-pg': {
url: 'http://127.0.0.1:2369',
database: {
client: 'pg',
connection: {
host : '127.0.0.1',
user : 'postgres',
password : '',
database : 'ghost_testing',
charset : 'utf8'
}
},
server: {
host: '127.0.0.1',
port: '2369'
},
logging: false
}
};
module.exports = config;
基本的に、私が行ったときhttp://localhost:9000/blog
、それはまったくレンダリングされていません。何もない。私はChromeを使用していましたが、Safariを使用してテストしました。また、JavaScript をオンにせずにこれら 2 つをテストしました。
そして、私はやろうcurl http://localhost:9000/blog
とし、リクエスターアプリ(Postmanなど)を使用しようとすると、正しいhtml文字列が返されました。また、ユーザー エージェントを Chrome および Safari として使用しようとしましたcurl
が、正しい html も返されます。
ghost
node_modulesまでたどると、レンダラーはghost > core > server > controllers > frontend > index.js
この行にありますres.render(view, result)
res.render
私はこのように変更しました
res.render(view, result, function(err, string) {
console.log("ERR", err);
console.log("String", string);
res.send(string);
})
エラーはありません。現在の文字列をログに記録しますが、ブラウザには何も表示されません。
curl、postman、works を試しましたが、ブラウザが機能しません。
次に、文字列を送信しようとしましたがhello world
、機能し、ブラウザがレンダリングしました。
次に、文字列の長さを 1 つずつ追加するとstr.length < 1023
、ブラウザでレンダリングできるようになりますが、それを超えるとレンダリングできなくなります。
親の Express アプリで試してみたところ、長さが 1023 を超える文字列を送信できます。また、ゴースト モジュールをスタンドアロンとして使用すると、1023 を超える文字列も送信できます。
そのため、これら 2 つの間で何かが起こったに違いありませんが、これをデバッグする方法がわかりません。
助けてください