Skip to content

Commit

Permalink
отредактировала функцию connect
Browse files Browse the repository at this point in the history
  • Loading branch information
olesia1205 committed Apr 30, 2023
1 parent 071d73c commit 3041d40
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const SERVER_ERROR = http2.constants.HTTP_STATUS_INTERNAL_SERVER_ERROR;

const app = express();

// app.use(cors({ origin: ['http://localhost:3000', 'http://localhost:3001', 'http://mesto.olerastova.nomoredomains.monster'], maxAge: 30 }));
// mongoose.connect(MONGO_URL, {});
mongoose.connect(MONGO_URL, {});
app.use(cors());

app.use(requestLogger);
Expand Down Expand Up @@ -53,16 +52,12 @@ app.use((err, req, res, next) => {
});

async function connect() {
// try {
// await app.listen(process.env.PORT || 3000);
// } catch (e) {
// console.log(`Server listen port ${process.env.PORT}`);
// }
// await mongoose.connect(process.env.MONGO_URL, {});
await mongoose.connect(MONGO_URL, {});
// console.log(`Server connected db ${process.env.MONGO_URL}`);
await app.listen(process.env.PORT);
console.log(`Server listen port ${process.env.PORT}`);
try {
await app.listen(process.env.PORT || 3000);
// console.log(`Server listen port ${process.env.PORT}`);
} catch (e) {
console.log(e);
}
}

connect();

0 comments on commit 3041d40

Please sign in to comment.