mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-12-10 19:54:15 +03:00
Merge e22d31e6ee into 56de415db0
This commit is contained in:
commit
1ec4c1ad95
|
|
@ -1,10 +1,10 @@
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import http from 'http';
|
|
||||||
import getPort from 'get-port';
|
import getPort from 'get-port';
|
||||||
import socketClusterServer from 'socketcluster-server';
|
import socketClusterServer from 'socketcluster-server';
|
||||||
import getOptions from './options.js';
|
import getOptions from './options.js';
|
||||||
import routes from './routes.js';
|
import routes from './routes.js';
|
||||||
import createStore from './store.js';
|
import createStore from './store.js';
|
||||||
|
import { createServer } from './utils/create-server.js';
|
||||||
|
|
||||||
// const LOG_LEVEL_NONE = 0;
|
// const LOG_LEVEL_NONE = 0;
|
||||||
// const LOG_LEVEL_ERROR = 1;
|
// const LOG_LEVEL_ERROR = 1;
|
||||||
|
|
@ -37,7 +37,8 @@ export default async function (argv: { [arg: string]: any }): Promise<{
|
||||||
console.log('[ReduxDevTools] Start server...');
|
console.log('[ReduxDevTools] Start server...');
|
||||||
console.log('-'.repeat(80) + '\n');
|
console.log('-'.repeat(80) + '\n');
|
||||||
}
|
}
|
||||||
const httpServer = http.createServer();
|
|
||||||
|
const httpServer = createServer(argv);
|
||||||
const agServer = socketClusterServer.attach(httpServer, options);
|
const agServer = socketClusterServer.attach(httpServer, options);
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
|
||||||
25
packages/redux-devtools-cli/src/utils/create-server.ts
Normal file
25
packages/redux-devtools-cli/src/utils/create-server.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import http from 'http';
|
||||||
|
import https from 'https';
|
||||||
|
|
||||||
|
export const createServer = (argv: { [arg: string]: unknown }): http.Server | https.Server => {
|
||||||
|
const typedArgv = argv as {
|
||||||
|
protocol: string;
|
||||||
|
key: string;
|
||||||
|
cert: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
let result;
|
||||||
|
|
||||||
|
if (typedArgv.protocol === 'https') {
|
||||||
|
const options = {
|
||||||
|
key: typedArgv.key,
|
||||||
|
cert: typedArgv.cert,
|
||||||
|
};
|
||||||
|
|
||||||
|
result = https.createServer(options);
|
||||||
|
} else {
|
||||||
|
result = http.createServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user