How to export ghost as a express Route?

Hi want to add ghost into my existing express project,
is there a way to export ghost as a module and then use it in an express route?
what i’m looking for is like this:

const ghostApp =await  require(‘custom_module’).generate(some_custom_configs);
my_express_app.use(’/blog’,ghostApp)

Ghost is not intended to be usable as an express module. It should be run as a separate application and served on /blog by setting up your web server proxies accordingly.

1 Like

i’ve found a workaround this,

var ghost = require('ghost')

module.exports.setup = async function (app) {
    return new Promise((resolve,reject) => {
        ghost().then(function (ghostServer) {
            app.use('/', ghostServer.rootApp);
            resolve('done');
        })
            .catch(e => reject(e));
    })
};

and it works perfectly, running on subdomain.localhost:8080,

now how to set domain ? because every link goes to http://localhost:2368/
i want to set domain programmatically , and prevent ghost from running on port 2368

hi i want to add ghost to an existing express app,
the config file is a correct json file and path is valid

ghost({config: config_file_absolute_path,})
       .then(function (ghostServer) {
                app.use(ghostServer.rootApp);
                resolve('done');
                // ghostServer.start(app)
        })