-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (22 loc) · 749 Bytes
/
Copy pathindex.js
File metadata and controls
26 lines (22 loc) · 749 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
const express = require('express');
const mongodb = require('mongodb');
const mongoose = require('mongoose');
const dotenv = require('dotenv');
const path = require('path');
const jwt = require('jsonwebtoken');
dotenv.config();
//App Config
const app = express();
app.use(express.json());
// routes
const authRoute = require('./routes/Auth');
const recipeRoute = require('./routes/Recipes');
app.use('/recipeapi/auth', authRoute);
app.use('/recipeapi/', recipeRoute);
// conn to DB
mongoose.connect(process.env.MONGO_URL).then(
console.log('Connected to DB')
).catch((err) => console.log(err));
//Listener
const port = process.env.PORT || 5000;
app.listen(port, () => console.log(`Listening on localhost: ${port}`));