Skip to content

Commit 3883996

Browse files
committed
Added host and port resolution, need to test for non-local host return
1 parent fb8f9ea commit 3883996

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ router.post('/createDB', function (req,res) {
2121
// If user does exist send error response.
2222
res.send("User already exists, please supply new username.").status(409);
2323
} catch(err) {
24+
2425
// Handle duplicate database name.
2526
try {
2627
db._createDatabase(dbName);
2728
} catch (err) {
2829
res.send("Database already exists or invalid name supplied, please supply new dbName.").status(400);
2930
}
31+
3032
users.save(username, password, true);
3133
// Grants user access only to newly created database
3234
users.grantDatabase(username, dbName, 'rw');
@@ -38,7 +40,6 @@ router.post('/createDB', function (req,res) {
3840
.summary('Creates a database and returns name and login credentials.')
3941
.description('Creates a database with potentially randomly generated dbName, username, and password. ');
4042

41-
4243
function randomStringGenerator() {
4344
// Database name must start with letter.
4445
return "ML" + Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);

0 commit comments

Comments
 (0)