Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
C4Ai_DR-P
public-service-provider
Commits
fe84967a
Commit
fe84967a
authored
Jul 03, 2020
by
Mahdi Sellami
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added config file
parent
828a85dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
config/default.json
config/default.json
+8
-0
index.js
index.js
+4
-2
package.json
package.json
+1
-0
No files found.
config/default.json
0 → 100644
View file @
fe84967a
{
"dbConfig"
:
{
"host"
:
"mongodb://127.0.0.1"
},
"serverConfig"
:
{
"port"
:
8080
}
}
\ No newline at end of file
index.js
View file @
fe84967a
...
...
@@ -3,8 +3,10 @@
var
path
=
require
(
'
path
'
);
var
http
=
require
(
'
http
'
);
var
config
=
require
(
'
config
'
);
var
oas3Tools
=
require
(
'
oas3-tools
'
);
var
serverPort
=
8080
;
var
serverPort
=
config
.
get
(
'
serverConfig.port
'
)
;
// swaggerRouter configuration
var
options
=
{
...
...
@@ -23,7 +25,7 @@ http.createServer(app).listen(serverPort, function () {
//Set up mongoose connection
var
mongoose
=
require
(
'
mongoose
'
);
var
mongoDB
=
'
mongodb://127.0.0.1
'
;
var
mongoDB
=
config
.
get
(
'
dbConfig.host
'
)
;
mongoose
.
connect
(
mongoDB
,
{
useNewUrlParser
:
true
,
useUnifiedTopology
:
true
});
var
db
=
mongoose
.
connection
;
db
.
on
(
'
error
'
,
console
.
error
.
bind
(
console
,
'
MongoDB connection error:
'
));
package.json
View file @
fe84967a
...
...
@@ -13,6 +13,7 @@
"license"
:
"
Unlicense
"
,
"private"
:
true
,
"dependencies"
:
{
"
config
"
:
"
^3.3.1
"
,
"
connect
"
:
"
^3.2.0
"
,
"
js-yaml
"
:
"
^3.3.0
"
,
"
mongoose
"
:
"
^5.9.21
"
,
...
...
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