Home Reference Source Repository
public class | source

UserController

Class for CRUD operations for users.

Constructor Summary

Public Constructor
public

Create a new UserController object

Method Summary

Public Methods
public

getUser(req: Request, res: Response, next: function): JSON

Get an user based on the id.

public

login(req: Request, res: Response, next: function): JSON

Login with an user.

public

register(req: Request, res: Response, next: function): JSON

Register a new user.

Public Constructors

public constructor() source

Create a new UserController object

Public Methods

public getUser(req: Request, res: Response, next: function): JSON source

Get an user based on the id.

Params:

NameTypeAttributeDescription
req Request

The express request object.

res Response

The express response object.

next function

The next function for Express.

Return:

JSON

A user based on the given id.

public login(req: Request, res: Response, next: function): JSON source

Login with an user.

Params:

NameTypeAttributeDescription
req Request

The express request object.

res Response

The express response object.

next function

The next function for Express.

Return:

JSON

The authentication token for the user.

public register(req: Request, res: Response, next: function): JSON source

Register a new user.

Params:

NameTypeAttributeDescription
req Request

The express request object.

res Response

The express response object.

next function

The next function for Express.

Return:

JSON

The authentication token for the user.