reorder them so that more specific routes come before less specific routes

Solutions on MaxInterview for reorder them so that more specific routes come before less specific routes by the best coders in the world

showing results for - "reorder them so that more specific routes come before less specific routes"
Jana
30 Sep 2019
1const express = require('express');
2const app = express();
3const port = 3000;
4
5const plants = ['Monstera Deliciosa', 'Corpse Flower', 'Elephant-Foot Yam',  "Witches' Butter",];
6
7app.get('/awesome', (req, res) => {
8  res.send(`
9    <h1>Plants are awesome!</h1>
10    <img src="https://static.boredpanda.com/blog/wp-content/uuuploads/plant-sculptures-mosaicultures-internationales-de-montreal/plant-sculptures-mosaicultures-internationales-de-montreal-14.jpg" >
11  `);
12});
13
14app.get('/:indexOfPlantsArray', (req, res) => {
15    res.send(plants[req.params.indexofPlantsArray]);
16});
17
18app.listen(port,() => {
19    console.log('listening on port' , port);
20});