-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
index.js
30 lines (26 loc) · 1.3 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* global hexo */
'use strict';
hexo.config.server = Object.assign({
port: 4000,
log: false,
// `undefined` uses Node's default (try `::` with fallback to `0.0.0.0`)
ip: undefined,
compress: false,
header: true
}, hexo.config.server);
hexo.extend.console.register('server', 'Start the server.', {
desc: 'Start the server and watch for file changes.',
options: [
{name: '-i, --ip', desc: 'Override the default server IP. Bind to all IP address by default.'},
{name: '-p, --port', desc: 'Override the default port.'},
{name: '-s, --static', desc: 'Only serve static files.'},
{name: '-l, --log [format]', desc: 'Enable logger. Override log format.'},
{name: '-o, --open', desc: 'Immediately open the server url in your default web browser.'}
]
}, require('./lib/server'));
hexo.extend.filter.register('server_middleware', require('./lib/middlewares/header'));
hexo.extend.filter.register('server_middleware', require('./lib/middlewares/gzip'));
hexo.extend.filter.register('server_middleware', require('./lib/middlewares/logger'));
hexo.extend.filter.register('server_middleware', require('./lib/middlewares/route'));
hexo.extend.filter.register('server_middleware', require('./lib/middlewares/static'));
hexo.extend.filter.register('server_middleware', require('./lib/middlewares/redirect'));