// routes/front.js
import express from 'express'
const frontRouter = express.Router()

import indexRouter from './front/index.js'
frontRouter.use('/',indexRouter)

import loginRouter from './front/login.js'
frontRouter.use('/login',loginRouter)

export default frontRouter

 

// routes/front/home.js
import express from 'express'
const indexRouter = express.Router()
import home from '../../controllers/front/home.js'

indexRouter.get('/',async (req,res)=>{
    home.getItem(req,res)
})

export default indexRouter

 

// controllers/front/home.js
import config from "../../config.js"

class Home{
    async getItem(req,res){
        this.config = await config()
        this.config.pageTitle = 'ទំព័រដើម'
        this.config.route = '/'

        res.render('base',{data:this.config})
    }
}

export default new Home()

 

Heroku: https://khmerweb-sale.herokuapp.com