Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahim-ethem-ispir committed Sep 22, 2022
0 parents commit 8a5a06e
Show file tree
Hide file tree
Showing 14 changed files with 3,503 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PORT = 5000

# Database
DB_URL = "mongodb://localhost:27017/nodejs-starter-project"
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# compiled output
/dist
/node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Nodejs Express MongoDb Starter Project

## npm install
## npm start
33 changes: 33 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require("express-async-errors")
const express = require("express")
const app = express()
require("dotenv").config()
require("./src/db/dbConnection")
const port = process.env.PORT || 5001
const router = require("./src/routers")
const errorHandlerMiddleware = require("./src/middlewares/errorHandler")

// Middlewares
app.use(express.json())
app.use(express.json({limit: "50mb"}))
app.use(express.urlencoded({limit: "50mb", extended: true, parameterLimit: 50000}))



app.use("/api", router)



app.get("/", (req, res) => {
res.json({
message: "Hoş Geldiniz"
})
})


// hata yakalama
app.use(errorHandlerMiddleware)

app.listen(port, () => {
console.log(`Server ${port} portundan çalışıyor ...`);
})
Loading

0 comments on commit 8a5a06e

Please sign in to comment.