Skip to content

It's similar to "hexo-server" package, but it uses express instead of connect

License

Notifications You must be signed in to change notification settings

smrsan76/hexo-server-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hexo-server-express

It's similar to "hexo-server" package, but it uses express instead of connect.

NPM

Guides

These are some useful guides.

How to install ?

Enter it in a command line:

npm i hexo-server-express --save

How to start it ?

Enter it in command line:

hexo server-express

How to start it from node.js codes ?

Enter this codes in the start of your app:

const Hexo = require('hexo');
let hexo = new Hexo(process.cwd() /*The base dir*/, { /*Hexo options*/ });

hexo.init()
    .then(function(){

        hexo.call("server-express", { /*server options*/ })
            .then(() => {

                // do some stuff ...

            })
            .catch(err => {

                hexo.log.fatal("SERVER-EXPRESS START FAILED!!!");
                console.error(err);

            });

    });

and it should be start. As you can see, everything is similar to hexo-server , but I just changed the command name server to server-express.

How to use my app in a hexo server/server-express ?

Simply, make this server_middleware like codes below:

// ...
// After starting hexo from your node.js codes

// Make your app
const express = require("express");
let yourApp = express();

// Register a server_middleware
hexo.extend.filter.register('server_middleware', hexoApp => {

    hexoApp.use("/admin", yourApp);
    // or do whatever you want with hexoApp ...

});

Related Packages

  • hexo-app-connect: It lets you use hexo as a route in your main express/connect app

for getting more info, visit

hexo-server package on github

hexo-server package on npm

Made with ❤️ for hexo

About

It's similar to "hexo-server" package, but it uses express instead of connect

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published