Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
narayan committed Aug 20, 2024
1 parent 02ab6f2 commit 1e82bf7
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/node_modules
/.env
33 changes: 33 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"license": "ISC",
"description": "",
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"ejs": "^3.1.10",
"express": "^4.19.2",
"mongoose": "^8.5.3",
Expand Down
14 changes: 11 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import express from 'express'
import mongoose from 'mongoose'
import { urlShort, getOriginalUrl } from "./Controllers/url.js";

import {} from 'dotenv'
import cors from 'cors'

const app = express();
const port = 3001;

config({path:'.env'})

app.use(cors({
origin:true,
methods:["POST","GET","DELETE","PUT"],
credentials:true
}))

app.use(express.urlencoded({extended:true}))

mongoose
.connect(
"mongodb+srv://narayannerd:[email protected]/",
.connect(process.env.MongoUrl,
{
dbName: "NodeJS_Express_API_Connection",
}
Expand Down

0 comments on commit 1e82bf7

Please sign in to comment.