22
33'use strict' ;
44
5+ function unicodeToChar ( text ) {
6+ return text . replace ( / \\ u [ \d A - F ] { 4 } / gi,
7+ function ( match ) {
8+ return String . fromCharCode ( parseInt ( match . replace ( / \\ u / g, '' ) , 16 ) ) ;
9+ } ) ;
10+ }
11+
12+
513/********************************
614Dependencies
715********************************/
@@ -46,13 +54,13 @@ if(appEnv.isLocal){
4654 useCreateIndex : true ,
4755 useUnifiedTopology : true
4856 } ;
49- mongoose . connect ( process . env . MONGODB_URL , mongoDbOptions )
57+ mongoose . connect ( unicodeToChar ( process . env . MONGODB_URL ) , mongoDbOptions )
5058 . then ( res => console . log ( "Connected to mongodb instance" ) )
5159 . catch ( function ( reason ) {
5260 console . log ( 'Unable to connect to the mongodb instance. Error: ' , reason ) ;
5361 } ) ;
5462 sessionDB = process . env . MONGODB_URL ;
55- console . log ( 'Your MongoDB is running at ' + process . env . MONGODB_URL ) ;
63+ console . log ( 'Your MongoDB is running at ' + unicodeToChar ( process . env . MONGODB_URL ) ) ;
5664}
5765// Connect to MongoDB Service on IBM Cloud
5866else if ( ! appEnv . isLocal ) {
@@ -75,7 +83,7 @@ else if(!appEnv.isLocal) {
7583 console . log ( "Your MongoDB is running at " , mongoDbUrl ) ;
7684 // connect to our database
7785 mongoose . Promise = global . Promise ;
78- mongoose . connect ( mongoDbUrl , mongoDbOptions )
86+ mongoose . connect ( unicodeToChar ( mongoDbUrl ) , mongoDbOptions )
7987 . then ( res => console . log ( "Connected to mongodb instance." ) )
8088 . catch ( function ( reason ) {
8189 console . log ( 'Unable to connect to the mongodb instance. Error: ' , reason ) ;
0 commit comments