Reputation: 7249
I am using node-js restify. While signing a user up server.head('/signup', function (req, res, next)
I generate a custom token.
token = ***
res.set('token', token);
res.send();
I am trying to send the token back but I can't find any documentation on how this is done. How do I send a token in a header response?
Upvotes: 0
Views: 90
Reputation: 11940
Check this working sample
var express = require('express');
var app = express();
app.head('/token', function(req, res, next){
res.writeHead (200, {'token': Math.random()});
res.end();
});
app.listen(3001);
As you can see everything works as expected, the response body is always empty, but header has token field
Upvotes: 1