How can I pass a particular response JSON key value to url The 2019 Stack Overflow Developer Survey Results Are InHow do I pass command line arguments to a Node.js program?How can I pretty-print JSON using node.js?How to parse JSON using Node.js?How can I update NodeJS and NPM to the next versions?How can I set NODE_ENV=production on Windows?How to get the full url in Express?How can I update npm on Windows?Compare passwords BcryptJSExpress req.body not WorkingSeparate login auth for admin
Can distinct morphisms between curves induce the same morphism on singular cohomology?
JSON.serialize: is it possible to suppress null values of a map?
Pristine Bit Checking
Does light intensity oscillate really fast since it is a wave?
Dual Citizen. Exited the US on Italian passport recently
On the insanity of kings as an argument against monarchy
I see my dog run
Deadlock Graph and Interpretation, solution to avoid
It's possible to achieve negative score?
Why is Grand Jury testimony secret?
Which Sci-Fi work first showed weapon of galactic-scale mass destruction?
Should I use my personal or workplace e-mail when registering to external websites for work purpose?
Time travel alters history but people keep saying nothing's changed
Should I write numbers in words or as numerals when there are multiple next to each other?
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
How to change the limits of integration
Extreme, unacceptable situation and I can't attend work tomorrow morning
Idiomatic way to prevent slicing?
How to make payment on the internet without leaving a money trail?
Is bread bad for ducks?
Why could you hear an Amstrad CPC working?
Understanding the implication of what "well-defined" means for the operation in quotient group
Can't find the latex code for the ⍎ (down tack jot) symbol
Inversion Puzzle
How can I pass a particular response JSON key value to url
The 2019 Stack Overflow Developer Survey Results Are InHow do I pass command line arguments to a Node.js program?How can I pretty-print JSON using node.js?How to parse JSON using Node.js?How can I update NodeJS and NPM to the next versions?How can I set NODE_ENV=production on Windows?How to get the full url in Express?How can I update npm on Windows?Compare passwords BcryptJSExpress req.body not WorkingSeparate login auth for admin
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying to create a url route endpoint with a response json key value. I am new in backend with node and expressjs .
I have a response as:-
"_id": "5c820ec8251acd06",
"companyName": "Meta",
"contactDetails": "5545454",
"email": "gedibih@mail-cart.com",
"password": "$2a$10$gUQVYmlpnWSYN9Qw.AqXOOg9loi.4svuXEtw2x1W6O94BMmEBOI1i",
"fullName": "XYZ",
"companyID": "146224",
Now I want to create a new url with endpoint of companyID
's value ie;
router.get('/companyName/value',function(req,res)
here it is 146224
How can I pass companyID
value to url endpoint ? The value is changeable. As many companyID
in my database as per url will be generated.
Also the email address in the current JSON object can have only access to the link according to the companyID
node.js express routes
add a comment |
I am trying to create a url route endpoint with a response json key value. I am new in backend with node and expressjs .
I have a response as:-
"_id": "5c820ec8251acd06",
"companyName": "Meta",
"contactDetails": "5545454",
"email": "gedibih@mail-cart.com",
"password": "$2a$10$gUQVYmlpnWSYN9Qw.AqXOOg9loi.4svuXEtw2x1W6O94BMmEBOI1i",
"fullName": "XYZ",
"companyID": "146224",
Now I want to create a new url with endpoint of companyID
's value ie;
router.get('/companyName/value',function(req,res)
here it is 146224
How can I pass companyID
value to url endpoint ? The value is changeable. As many companyID
in my database as per url will be generated.
Also the email address in the current JSON object can have only access to the link according to the companyID
node.js express routes
add a comment |
I am trying to create a url route endpoint with a response json key value. I am new in backend with node and expressjs .
I have a response as:-
"_id": "5c820ec8251acd06",
"companyName": "Meta",
"contactDetails": "5545454",
"email": "gedibih@mail-cart.com",
"password": "$2a$10$gUQVYmlpnWSYN9Qw.AqXOOg9loi.4svuXEtw2x1W6O94BMmEBOI1i",
"fullName": "XYZ",
"companyID": "146224",
Now I want to create a new url with endpoint of companyID
's value ie;
router.get('/companyName/value',function(req,res)
here it is 146224
How can I pass companyID
value to url endpoint ? The value is changeable. As many companyID
in my database as per url will be generated.
Also the email address in the current JSON object can have only access to the link according to the companyID
node.js express routes
I am trying to create a url route endpoint with a response json key value. I am new in backend with node and expressjs .
I have a response as:-
"_id": "5c820ec8251acd06",
"companyName": "Meta",
"contactDetails": "5545454",
"email": "gedibih@mail-cart.com",
"password": "$2a$10$gUQVYmlpnWSYN9Qw.AqXOOg9loi.4svuXEtw2x1W6O94BMmEBOI1i",
"fullName": "XYZ",
"companyID": "146224",
Now I want to create a new url with endpoint of companyID
's value ie;
router.get('/companyName/value',function(req,res)
here it is 146224
How can I pass companyID
value to url endpoint ? The value is changeable. As many companyID
in my database as per url will be generated.
Also the email address in the current JSON object can have only access to the link according to the companyID
node.js express routes
node.js express routes
edited Mar 8 at 8:44
NoobCoder
asked Mar 8 at 8:39
NoobCoderNoobCoder
54
54
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can use the params:
router.get('/companyName/:id', function(req,res)
// your id is now in req.params.id
)
All abouts Express params here: https://expressjs.com/en/4x/api.html#req.params
The user must login and when he/she logs in then user must redirect to/companyName/:id
– NoobCoder
Mar 8 at 8:54
User login -> you send him the response with the compagny id -> you automatically (in your frontend part) make a call to your API with the compagny id
– SylvainF
Mar 8 at 9:06
But when login, I am getting a response of JWT token. How can I extractcompanyid
details from there ?
– NoobCoder
Mar 8 at 9:17
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55059471%2fhow-can-i-pass-a-particular-response-json-key-value-to-url%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use the params:
router.get('/companyName/:id', function(req,res)
// your id is now in req.params.id
)
All abouts Express params here: https://expressjs.com/en/4x/api.html#req.params
The user must login and when he/she logs in then user must redirect to/companyName/:id
– NoobCoder
Mar 8 at 8:54
User login -> you send him the response with the compagny id -> you automatically (in your frontend part) make a call to your API with the compagny id
– SylvainF
Mar 8 at 9:06
But when login, I am getting a response of JWT token. How can I extractcompanyid
details from there ?
– NoobCoder
Mar 8 at 9:17
add a comment |
You can use the params:
router.get('/companyName/:id', function(req,res)
// your id is now in req.params.id
)
All abouts Express params here: https://expressjs.com/en/4x/api.html#req.params
The user must login and when he/she logs in then user must redirect to/companyName/:id
– NoobCoder
Mar 8 at 8:54
User login -> you send him the response with the compagny id -> you automatically (in your frontend part) make a call to your API with the compagny id
– SylvainF
Mar 8 at 9:06
But when login, I am getting a response of JWT token. How can I extractcompanyid
details from there ?
– NoobCoder
Mar 8 at 9:17
add a comment |
You can use the params:
router.get('/companyName/:id', function(req,res)
// your id is now in req.params.id
)
All abouts Express params here: https://expressjs.com/en/4x/api.html#req.params
You can use the params:
router.get('/companyName/:id', function(req,res)
// your id is now in req.params.id
)
All abouts Express params here: https://expressjs.com/en/4x/api.html#req.params
answered Mar 8 at 8:50
SylvainFSylvainF
183113
183113
The user must login and when he/she logs in then user must redirect to/companyName/:id
– NoobCoder
Mar 8 at 8:54
User login -> you send him the response with the compagny id -> you automatically (in your frontend part) make a call to your API with the compagny id
– SylvainF
Mar 8 at 9:06
But when login, I am getting a response of JWT token. How can I extractcompanyid
details from there ?
– NoobCoder
Mar 8 at 9:17
add a comment |
The user must login and when he/she logs in then user must redirect to/companyName/:id
– NoobCoder
Mar 8 at 8:54
User login -> you send him the response with the compagny id -> you automatically (in your frontend part) make a call to your API with the compagny id
– SylvainF
Mar 8 at 9:06
But when login, I am getting a response of JWT token. How can I extractcompanyid
details from there ?
– NoobCoder
Mar 8 at 9:17
The user must login and when he/she logs in then user must redirect to
/companyName/:id
– NoobCoder
Mar 8 at 8:54
The user must login and when he/she logs in then user must redirect to
/companyName/:id
– NoobCoder
Mar 8 at 8:54
User login -> you send him the response with the compagny id -> you automatically (in your frontend part) make a call to your API with the compagny id
– SylvainF
Mar 8 at 9:06
User login -> you send him the response with the compagny id -> you automatically (in your frontend part) make a call to your API with the compagny id
– SylvainF
Mar 8 at 9:06
But when login, I am getting a response of JWT token. How can I extract
companyid
details from there ?– NoobCoder
Mar 8 at 9:17
But when login, I am getting a response of JWT token. How can I extract
companyid
details from there ?– NoobCoder
Mar 8 at 9:17
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55059471%2fhow-can-i-pass-a-particular-response-json-key-value-to-url%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown