Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game-cli
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
game-cli
Commits
0cd5e26e
Commit
0cd5e26e
authored
May 23, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proxy
parent
97cbe806
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
2 deletions
+5
-2
game-cli-mock.js
bin/game-cli-mock.js
+2
-0
index.js
bin/json-server/index.js
+2
-2
game-cli.iml
game-cli.iml
+1
-0
No files found.
bin/game-cli-mock.js
View file @
0cd5e26e
...
...
@@ -5,6 +5,7 @@ const jsonServer = require('./json-server');
program
.
option
(
'-h, --host [string]'
,
'server host'
,
'localhost'
)
.
option
(
'-p, --port [number]'
,
'server port'
,
3000
)
.
option
(
'--proxy [string]'
,
'server proxy address'
)
.
option
(
'-f, --folder [string]'
,
'folder of json files'
,
'./'
)
.
option
(
'-k, --key-file [string]'
,
'ssl key file'
)
.
option
(
'-c, --cert-file [string]'
,
'ssl cert file'
)
...
...
@@ -16,6 +17,7 @@ async function execute() {
jsonServer
.
start
({
host
:
program
.
host
,
port
:
program
.
port
,
proxy
:
program
.
port
,
folder
:
program
.
folder
,
keyFile
:
program
.
keyFile
,
certFile
:
program
.
certFile
,
...
...
bin/json-server/index.js
View file @
0cd5e26e
...
...
@@ -31,7 +31,7 @@ function handler(request, response) {
content
=
fs
.
readFileSync
(
targetFile
,
'utf-8'
);
}
else
if
(
fs
.
existsSync
(
targetFile
=
filePath
+
'/index.js'
))
{
try
{
const
jsonObject
=
require
(
targetFile
);
const
jsonObject
=
require
(
targetFile
)
()
;
content
=
JSON
.
stringify
(
jsonObject
);
}
catch
(
e
)
{
console
.
log
(
e
);
...
...
@@ -60,7 +60,7 @@ function handler(request, response) {
exports
.
start
=
function
(
options
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
{
port
,
host
,
folder
,
keyFile
,
certFile
}
=
options
;
const
{
port
,
host
,
proxy
,
folder
,
keyFile
,
certFile
}
=
options
;
jsonPath
=
path
.
resolve
(
folder
);
if
(
fs
.
existsSync
(
jsonPath
))
{
...
...
game-cli.iml
View file @
0cd5e26e
...
...
@@ -3,6 +3,7 @@
<component
name=
"NewModuleRootManager"
inherit-compiler-output=
"true"
>
<exclude-output
/>
<content
url=
"file://$MODULE_DIR$"
/>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</module>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment