-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
30 lines (22 loc) · 764 Bytes
/
app.js
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
29
30
// default imports
import express from "express"
import { fileURLToPath } from 'url'
import path from "path"
// import routers
import indexRouter from "./routes/indexRouter.js"
import newRouter from "./routes/newRouter.js"
import messageRouter from "./routes/messageRouter.js"
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const app = express()
app.use(express.urlencoded({ extended: true }));
app.set("views", path.join(__dirname, "views"))
app.set("view engine", "ejs")
// handle routes using Express Router
app.use("/message", messageRouter)
app.use("/new", newRouter)
app.use("/", indexRouter)
const PORT = 3000
app.listen(3000, () => {
console.log(`mini messsage board is running on PORT:${PORT}`)
})