📜  重新排序它们,以便更具体的路线出现在不太具体的路线之前 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:25.759000             🧑  作者: Mango

代码示例1
const express = require('express');
const app = express();
const port = 3000;

const plants = ['Monstera Deliciosa', 'Corpse Flower', 'Elephant-Foot Yam',  "Witches' Butter",];

app.get('/awesome', (req, res) => {
  res.send(`
    

Plants are awesome!

`); }); app.get('/:indexOfPlantsArray', (req, res) => { res.send(plants[req.params.indexofPlantsArray]); }); app.listen(port,() => { console.log('listening on port' , port); });