31 lines
842 B
JavaScript
31 lines
842 B
JavaScript
const express = require("express");
|
|
const cors = require("cors");
|
|
|
|
const app = express();
|
|
|
|
const corsOptions = {
|
|
origin: "http://localhost:5173"
|
|
};
|
|
|
|
app.use(cors(corsOptions));
|
|
// parse requests of content-type - application/json
|
|
app.use(express.json());
|
|
// parse requests of content-type - application/x-www-form-urlencoded
|
|
app.use(express.urlencoded({ extended: true }));
|
|
|
|
// db.sequelize.sync();
|
|
// force: true will drop the table if it already exists
|
|
// db.sequelize.sync({force: true}).then(() => {
|
|
// console.log('Drop and Re-sync Database with { force: true }');
|
|
// initial();
|
|
// });
|
|
|
|
// routes
|
|
require('./routes/info.routes')(app);
|
|
require('./routes/auth.routes')(app);
|
|
require('./routes/user.routes')(app);
|
|
require('./routes/pitchType.routes')(app);
|
|
require('./routes/bullpenSession.routes')(app);
|
|
|
|
module.exports = app;
|