Skip to content

Commit

Permalink
first Skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
El-khamisi committed Apr 4, 2022
0 parents commit a6d958f
Show file tree
Hide file tree
Showing 34 changed files with 6,291 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
.env
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
semi: true
singleQuote: true
printWidth: 1000
Empty file added README.md
Empty file.
50 changes: 50 additions & 0 deletions index.js
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}`);
});
}

Loading

0 comments on commit a6d958f

Please sign in to comment.