Logout Procedure

If you want to log out the user, call the express-sweet.services.Authentication.logout() method.
Invoking logout() will remove the req.user property and clear the login session (if any).
import {Router} from 'express';
import * as sweet from 'express-sweet';
const router = Router();
const Authentication = sweet.services.Authentication;

router.get('/logout', (req, res) => {
  Authentication.logout(req);
  res.redirect('/');
});
export default router;
const express = require('express');
const router = express.Router();
const Authentication = require('express-sweet').services.Authentication;

router.get('/logout', (req, res) => {
  Authentication.logout(req);
  res.redirect('/');
});
module.exports = router;
<a href="/api/users/logout">Logout</a>