You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
565 B
23 lines
565 B
import express from "express";
|
|
import db from "./config/database.js";
|
|
import blogRoutes from "./routes/index.js"
|
|
// import Blog from "./models/blogModel.js";
|
|
// import BlogImage from "./models/blogImage.js";
|
|
import cors from "cors";
|
|
|
|
const app = express();
|
|
|
|
try {
|
|
// await db.sync();
|
|
await db.authenticate();
|
|
console.log('Database connected...');
|
|
} catch(error){
|
|
console.log('Connection error:', error);
|
|
};
|
|
|
|
app.use(cors());
|
|
app.use(express.json());
|
|
app.use ('/blog', blogRoutes);
|
|
|
|
|
|
app.listen(5000,() => console.log('server running at port 5000'));
|