-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from KOSASIH/deepsource-transform-803af0f8
style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf
- Loading branch information
Showing
1 changed file
with
20 additions
and
20 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 |
---|---|---|
@@ -1,35 +1,35 @@ | ||
const express = require("express"); | ||
const bodyParser = require("body-parser"); | ||
const cors = require("cors"); | ||
const mongoose = require("mongoose"); | ||
const express = require('express') | ||
const bodyParser = require('body-parser') | ||
const cors = require('cors') | ||
const mongoose = require('mongoose') | ||
|
||
const { JWT_SECRET, MONGODB_URI } = process.env; | ||
const { JWT_SECRET, MONGODB_URI } = process.env | ||
|
||
const app = express(); | ||
const app = express() | ||
|
||
app.use(bodyParser.json()); | ||
app.use(cors()); | ||
app.use(bodyParser.json()) | ||
app.use(cors()) | ||
|
||
const router = require("./routes"); | ||
app.use("/api", router); | ||
const router = require('./routes') | ||
app.use('/api', router) | ||
|
||
const connectToMongoDB = async () => { | ||
try { | ||
await mongoose.connect(MONGODB_URI, { | ||
useNewUrlParser: true, | ||
useUnifiedTopology: true, | ||
useCreateIndex: true, | ||
}); | ||
console.log("Connected to MongoDB"); | ||
useCreateIndex: true | ||
}) | ||
console.log('Connected to MongoDB') | ||
} catch (error) { | ||
console.error("Failed to connect to MongoDB", error); | ||
process.exit(1); | ||
console.error('Failed to connect to MongoDB', error) | ||
process.exit(1) | ||
} | ||
}; | ||
} | ||
|
||
connectToMongoDB(); | ||
connectToMongoDB() | ||
|
||
const PORT = process.env.PORT || 5000; | ||
const PORT = process.env.PORT || 5000 | ||
app.listen(PORT, () => { | ||
console.log(`Server running on port ${PORT}`); | ||
}); | ||
console.log(`Server running on port ${PORT}`) | ||
}) |