-
Notifications
You must be signed in to change notification settings - Fork 8
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 8a5a06e
Showing
14 changed files
with
3,503 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,4 @@ | ||
PORT = 5000 | ||
|
||
# Database | ||
DB_URL = "mongodb://localhost:27017/nodejs-starter-project" |
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,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 |
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,4 @@ | ||
# Nodejs Express MongoDb Starter Project | ||
|
||
## npm install | ||
## npm start |
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,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 ...`); | ||
}) |
Oops, something went wrong.