• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

how specify in router any value

Scheduled Pinned Locked Moved Plugin Development
pluginplugin errorroutes
3 Posts 2 Posters 1.9k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • DoppyD Offline
    DoppyD Offline
    Doppy GNU/Linux
    wrote on last edited by Doppy
    #1

    Suppose to have this in my library.js

    router.get('/user/', controllers.red);

    Now I need to specify in the url of router any value that can represent username of user like:
    /user/something that represent character

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #2

    Do this

    router.get('/user/:username', controllers.red);
    
    controllers.red = function(req, res, next) {
       console.log(req.params.username);
    }
    
    1 Reply Last reply
    1
  • DoppyD Offline
    DoppyD Offline
    Doppy GNU/Linux
    wrote on last edited by
    #3
    This post is deleted!
    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development