1
0
Prechádzať zdrojové kódy

FileServer.st: add -p commandline option

node server/server.js -p 5000

will start the server to listen on port 5000
mkroehnert 12 rokov pred
rodič
commit
9b4ca5d461
1 zmenil súbory, kde vykonal 8 pridanie a 0 odobranie
  1. 8 0
      server/FileServer.st

+ 8 - 0
server/FileServer.st

@@ -573,6 +573,14 @@ mimeTypeFor: aString
 !FileServer class methodsFor: 'initialization'!
 
 main
+	| arguments portOption port|
+	arguments := process argv.
+	portOption := arguments at: 3 ifAbsent: [nil].
+	port := arguments at: 4 ifAbsent: [nil].
+
+	('-p' = portOption and: [port notNil]) ifTrue: [
+		FileServer port: port.
+	].
 	^self new startOn: self port
 ! !