ផ្លូវ​មាន​ប៉ារ៉ាម៉ែត (route parameter) គឺ​ជា​បណ្តា​ URL ទាំងឡាយ​ណា​ដែល​ផ្នែក​របស់​វា​មួយ​ចំនួនអាច​​ត្រូវ​ប្រែប្រួល​ទៅ​តាម​កាលទេស។ ពិនិត្យ​កម្មវិធី​ខាង​ក្រោម​នេះ៖

 

import express from 'express'
import path from 'path'

const app = express()
const port = process.env.PORT || 3000
const __dirname = path.resolve()
 
import index from './routes/index.js'
import backend from './routes/backend.js'

app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'ejs')
app.use(express.static(path.join(__dirname, 'public')))
                                  
app.use('/',index) 
app.use('/backend',backend) 

app.listen(port,function(){
    console.log(`This application is listening to the port: ${port}`)
})

 

/* ./routes/backend.js */
import express from 'express'
const backend = express.Router()
 
/* GET backend page. */
backend.get('/:page', function(req, res, next) {
    const data = req.params
    res.render('backend',data)
})
 
export default backend

 

<!--views/backend.ejs-->
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Express.js Web Framework</title>
    <link href="/fonts/setup.css" rel="stylesheet">
    <link href="/styles/base.css" rel="stylesheet">
  </head>
  <body>
    <p><%= page %></p>
  </body>
</html>