1. app.js

const allController = require('./homeController')
app.get('/show', allController.getAllUser)

2. homeController.js

const user_model = require('./user_model') // include user_model.jsexports.getAllUser = async (req, res, next) => {
let user_data = await user_model.find()
res.render('show',{user_data})
}

3. Create Show.ejs file:

vim show.ejsblog_expressjs/views/show.ejs<table class="table">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>

<% for(let p of user_data) { %>
<tr>
<th><%= p.id %></th>
<td><%= p.title %></td>
<td><%= p.description %></td>
<td>
<a class="btn btn-md btn-success">Edit</a>
<a class="btn btn-md btn-danger">Delete</a>
</td>
</tr>
<% } %></tbody>
</table>

--

--

/* 
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/

@media (min-width: 1281px) {

//CSS

}

/*
##Device = Laptops, Desktops
##Screen = B/w 1025px to 1280px
*/

@media (min-width: 1025px) and (max-width: 1280px) {

//CSS

}

/*
##Device = Tablets, Ipads (portrait)
##Screen = B/w 768px to 1024px
*/

@media (min-width: 768px) and (max-width: 1024px) {

//CSS

}

/*
##Device = Tablets, Ipads (landscape)
##Screen = B/w 768px to 1024px
*/

@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {

//CSS

}

/*
##Device = Low Resolution Tablets, Mobiles (Landscape)
##Screen = B/w 481px to 767px
*/

@media (min-width: 481px) and (max-width: 767px) {

//CSS

}

/*
##Device = Most of the Smartphones Mobiles (Portrait)
##Screen = B/w 320px to 479px
*/

@media (min-width: 320px) and (max-width: 480px) {

//CSS

}

--

--

navigator.browserDetection= (function(){
var ua= navigator.userAgent, tem,
M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem= /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE '+(tem[1] || '');
}…

--

--