Commit fe84967a authored by Mahdi Sellami's avatar Mahdi Sellami

added config file

parent 828a85dc
{
"dbConfig": {
"host": "mongodb://127.0.0.1"
},
"serverConfig": {
"port": 8080
}
}
\ No newline at end of file
......@@ -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:'));
......@@ -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",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment