-
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.
add dotenv package and updating somes files
- Loading branch information
Showing
4 changed files
with
30 additions
and
5 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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
require('dotenv').config(); | ||
const mongoose = require('mongoose'); | ||
|
||
const connectionString = 'mongodb+srv://djibba:[email protected]/taskDatabase?retryWrites=true&w=majority'; | ||
const connectionString = "mongodb+srv://" + process.env.DB_USER + ":" + process.env.DB_PASSWORD + "@"+ process.env.DB_HOST +"/" + process.env.DB + "?retryWrites=true&w=majority"; | ||
|
||
mongoose.connect(connectionString, { useNewUrlParser: true, useUnifiedTopology: true }) | ||
.then(() => console.log('Connection for database successfully !')) | ||
|
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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
const { | ||
getAllTasks | ||
getAllTasks, | ||
createTasks, | ||
getSingleTask, | ||
updateTask, | ||
deleteTask | ||
} = require('../controllers/taskController'); | ||
|
||
router.route('/api/tasks').get(getAllTasks); | ||
router.route('/api/tasks').get(getAllTasks).post(createTasks); | ||
router.route('/api/task/:id').get(getSingleTask).put(updateTask).delete(deleteTask); | ||
|
||
module.exports = router; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require('dotenv').config(); | ||
const http = require('http'); | ||
const app = require('./app'); | ||
|
||
|