Skip to content

Commit

Permalink
Fix code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gowribhat committed Oct 20, 2023
1 parent 35e7c4d commit a06a33a
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions question-service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ import { createQuestionCounter } from "./controllers/questionCounter.js";
import { createLeetcodeCounter } from "./controllers/leetcode.js";

dotenv.config("./.env");
const uri = process.env.MONGO_OPTION == "cloud" ? process.env.MONGO_CLOUD_URI : process.env.MONGO_LOCAL_DOCKER_URI;
const uri =
process.env.MONGO_OPTION == "cloud"
? process.env.MONGO_CLOUD_URI
: process.env.MONGO_LOCAL_DOCKER_URI;
const port = process.env.PORT || 3001;
const connectionOptions = {dbName: `peerprep-database`};
const connectionOptions = { dbName: `peerprep-database` };

dns.setDefaultResultOrder('ipv4first');
dns.setDefaultResultOrder("ipv4first");
const app = express();

console.log(uri);
Expand All @@ -23,7 +26,7 @@ async function getConnection() {
await mongoose.connect(uri, connectionOptions);
console.log(`Successfully connected to MonogDB!`);
} catch (error) {
console.log(`Failed to connect to MongoDB!`);
console.log(`Failed to connect to MongoDB!`, error);
await new Promise(resolve => setTimeout(resolve, 1000));
return getConnection();
}
Expand All @@ -32,16 +35,16 @@ await getConnection();

app.use(cors());
app.use(express.json());
if (process.env.NODE_ENV === 'development') {
app.use(morgan('tiny'));
if (process.env.NODE_ENV === "development") {
app.use(morgan("tiny"));
};

createQuestionCounter();
createLeetcodeCounter();

//app.use('/api/question', QuestionRouter);
app.use('/', QuestionRouter);
app.use("/", QuestionRouter);

app.listen(port, () => {
console.log(`Question Service is running on port: ${port}`);
console.log(`Question Service is running on port: ${port}`);
});

0 comments on commit a06a33a

Please sign in to comment.