-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
34 lines (27 loc) · 847 Bytes
/
app.js
File metadata and controls
34 lines (27 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const express = require("express");
const mongoose = require("mongoose");
const bodyParser = require("body-parser");
const cors = require("cors");
require("dotenv").config();
const app = express();
const authRoutes = require("./routes/auth.routes");
const oauthRoutes = require("./routes/oauth.routes");
app.use(
cors({
origin: [
"http://localhost:3000",
"https://authenticator-frontend.vercel.app",
"https://authenticator-frontend-git-fork-14r14-main-cal-commit-new.vercel.app",
],
})
);
app.use(express.json());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use("/auth", authRoutes);
app.use("/oauth", oauthRoutes);
mongoose.connect(process.env.CONNECTION_STRING).then(() => {
app.listen(8081, () => {
console.log("Example app listening on port 8081!");
});
});