Install ghost from source
First, you should know how to develop with ghost.create a new react app under core/server folder
simple examplecore/server$ mkdir newapp
core/server$ cd newapp
core/server/newapp$
Ghost/core/server/web/newapp$ ls
app.js controller.js index.js
Ghost/core/server/web/newapp$ cat index.js
module.exports = require('./app');
Ghost/core/server/web/newapp$ cat app.js
const express = require('express');
module.exports = function setupNewApp() {
const newApp = express();
newApp.get('*', require('./controller'));
return newApp;
};
Ghost/core/server/web/newapp$ cat controller.js
const path = require('path');
module.exports = function newAppController(req, res) {
res.send('Welcome to new App!');
};
Add route for your new site/app
./core/server/app.js // Mount the apps on the parentApp
// ADMIN
parentApp.use('/ghost', require('./admin')());
// import new app/site
parentApp.use('/newsite', require('./newapp')());
// BLOG
parentApp.use(require('./site')());
Notes
above are for ghost before 2.0 version.for latest ghost, version 2.0,
The folder for new app should be "
Ghost/core/server/web/newapp
"The hacked core js is
Ghost/core/server/web/parent-app.js
The code for add route is same as above.
Work your new app
grunt devnavigate to http://localhost:2368/newapp, you will get:
No comments:
Post a Comment