-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a6d958f
Showing
34 changed files
with
6,291 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
semi: true | ||
singleQuote: true | ||
printWidth: 1000 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const express = require('express'); | ||
const mongoose = require('mongoose'); | ||
|
||
|
||
//Config | ||
const {DBURI, DBURI_remote, PORT, NODE_ENV} = require('./src/config/env.js'); | ||
|
||
const port = PORT|| 8080; | ||
|
||
// const seeder = require('./src/models/seeder.model') | ||
|
||
|
||
if(NODE_ENV == 'dev'){ | ||
mongoose.connect(DBURI) | ||
.then(() => { | ||
console.log('connected to database successfully'); | ||
}) | ||
.catch(() => { | ||
console.log("can't connect to database"); | ||
}); | ||
}else{ | ||
mongoose.connect(DBURI_remote) | ||
.then(() => { | ||
console.log('connected to database successfully'); | ||
}) | ||
.catch(() => { | ||
console.log("can't connect to database"); | ||
}); | ||
} | ||
|
||
|
||
//Create Application | ||
const app = express(); | ||
|
||
const {superAdmin} = require('./src/config/seeder'); | ||
superAdmin(); | ||
|
||
const endpoints = require('./src/index.routes'); | ||
endpoints(app); | ||
|
||
if(NODE_ENV == 'dev'){ | ||
app.listen(process.argv[2], () => { | ||
console.log(`Production connected successfully ON PORT-${process.argv[2]}`); | ||
}); | ||
}else{ | ||
app.listen(port, () => { | ||
console.log(`connected successfully ON port-${port}`); | ||
}); | ||
} | ||
|
Oops, something went wrong.