BuildForSDGCohort2 / BuildForSDGCohort2/TEAM-050-Backend

citizens/register

Open
#13 5 comments 0 reactions 1 assignee Claimed by @udofia2 View on GitHub
help wanted
Dominant language
JavaScript
Stars
3
Forks
3
PR merge metrics
No merged PRs in 30d

Description

In the register controller(/api/v1/citizen/register), after registration and you 'citizen.save()', can you make it return a token just like it does in the login controller? The way it is now it seems, one would have to login again after registering.

you can make it something like:
```
await citizen.save();
const payload = {
id: citizen._id,
};
const token = jwt.sign(payload, mySecrete, { expiresIn: "1hr" });

res.json({
msg: "you are now logged in",
token,
});
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.