You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/serve/src/lib/server.ts
+38-15
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,4 @@
1
+
import{isEmpty}from'lodash';
1
2
import*asfsfrom'fs';
2
3
import*ashttpfrom'http';
3
4
import*ashttpsfrom'https';
@@ -13,15 +14,21 @@ import { getEnforceHttpsOptions } from './middleware';
13
14
exportclassVulcanServer{
14
15
privateconfig: ServeConfig;
15
16
privatecontainer: Container;
16
-
privateserver?: http.Server;
17
-
17
+
privateservers?: {
18
+
http: http.Server;
19
+
https?: https.Server;
20
+
};
18
21
constructor(config: ServeConfig){
19
22
this.config=config;
20
23
this.container=newContainer();
21
24
}
22
-
23
-
publicasyncstart(port=3000){
24
-
if(this.server)
25
+
/**
26
+
* Start the vulcan server
27
+
* @param port the http port for server start, default is 3000
28
+
* @param httpsPort the https port for https server start when you set "type" = LOCAL in "enforce-https" middleware and provide ssl file, default port is 3001
29
+
*/
30
+
publicasyncstart(port=3000,httpsPort=3001){
31
+
if(!isEmpty(this.servers))
25
32
thrownewError('Server has created, please close it first.');
0 commit comments