-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (23 loc) · 778 Bytes
/
server.js
File metadata and controls
27 lines (23 loc) · 778 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
const express = require('express');
const sequelize = require('./config/connection');
const routes = require('./controllers')
const cors = require('cors');
const app = express();
const PORT = process.env.PORT || 3001;
const { cloudinary } = require('./utils/cloudinary');
const { User, Place, Comment, Vote, Reaction } = require("./models");
// DEVELOPMENT ONLY:
app.use(cors());
// FOR HEROKU DEPLOYMENT
// app.use(cors({
// origin:["https://petit-petfriendly.herokuapp.com/"]
// }));
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(express.static('public'));
app.use(routes)
sequelize.sync({ force: false }).then(function () {
app.listen(PORT, function () {
console.log('Listening at http://localhost:' + PORT);
})
})