forked from DBordallo/backend-API-REST
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
28 lines (23 loc) · 647 Bytes
/
app.js
File metadata and controls
28 lines (23 loc) · 647 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
28
import express from "express";
import cors from 'cors'
import db from "./database/db.js"
import brandRouter from './routes/brandRouter.js'
import productRouter from "./routes/productRouter.js";
export const app = express()
app.get('/', (_req, res) =>{
res.send('Hola Api')
})
app.use(cors())
app.use(express.json())
app.use('/brand', brandRouter)
app.use('/products', productRouter)
app.use('/brand/:id/', brandRouter)
try{
await db.authenticate()
console.log('conected to database')
}catch(error){
console.log(`error: ${error}`)
}
export const server = app.listen(8000,() =>{
console.log('🚀server up in http://localhost:8000/')
})