This endpoint is used to register a new user. It validates the input data and creates a new user in the database.
POST
/users/register
The request body should be a JSON object with the following fields:
fullname(object) :firstname(string,required): User's first name (min 3 characters)lastname(string,optional): User's last name (min 3 charcaters)
email(string,required): User's email address(must be a valid address)password(string,required) : User's password (min 6 characters)
user: (object) :fullname: (object).firstname(string):User's first name (min 3 characters)lastname(string):User's last name (min 3 charcaters)
email(string):User's email address(must be a valid address)password(string):User's password (min 6 characters)
token(string): JWT token
Example:
{
"fullname": {
"firstname": "John",
"lastname": "Doe"
},
"email": "john.doe@example.com",
"password": "password123"
}This endpoint is used to log in an existing user. It validates the input data and returns a JWT token if the credentials are correct.
POST
/users/login
The request body should be a JSON object with the following fields:
email(string,required): User's email address (must be a valid address)password(string,required): User's password (min 6 characters)
user: (object) :fullname: (object).firstname(string):User's first namelastname(string):User's last name
email(string):User's email addresspassword(string):Users password
token(string): JWT token
Example:
{
"email": "john.doe@example.com",
"token": "jwt-token"
}This endpoint is used to get the profile of the authenticated user.
GET
/users/profile
user: (object) :fullname: (object).firstname(string):User's first namelastname(string):User's last name
email(string):User's email address
Example:
{
"fullname": {
"firstname": "John",
"lastname": "Doe"
},
"email": "john.doe@example.com"
}This endpoint is used to log out the authenticated user.
POST
/users/logout
message(string): Confirmation message
Example:
{
"message": "Logged Out"
}This endpoint is used to register a new captain. It validates the input data and creates a new captain in the database.
POST
/captain/register
The request body should be a JSON object with the following fields:
fullname(object) :firstname(string, required): Captain's first name (min 3 characters)lastname(string, optional): Captain's last name (min 3 characters)
email(string, required): Captain's email address (must be a valid address)password(string, required): Captain's password (min 6 characters)vehicle(object):color(string, required): Vehicle color (min 3 characters)plate(string, required): Vehicle plate (min 3 characters)capacity(number, required): Vehicle capacity (min 1)vehicleType(string, required): Vehicle type (must be one of 'car', 'motorcycle', 'auto')
captain: (object):fullname: (object):firstname(string): Captain's first namelastname(string): Captain's last name
email(string): Captain's email addressvehicle: (object):color(string): Vehicle colorplate(string): Vehicle platecapacity(number): Vehicle capacityvehicleType(string): Vehicle type
token(string): JWT token
Example:
{
"fullname": {
"firstname": "Jane",
"lastname": "Doe"
},
"email": "jane.doe@example.com",
"password": "password123",
"vehicle": {
"color": "red",
"plate": "ABC123",
"capacity": 4,
"vehicleType": "car"
}
}This endpoint is used to log in an existing captain. It validates the input data and returns a JWT token if the credentials are correct.
POST
/captain/login
The request body should be a JSON object with the following fields:
email(string, required): Captain's email address (must be a valid address)password(string, required): Captain's password (min 6 characters)
captain: (object):fullname: (object):firstname(string): Captain's first namelastname(string): Captain's last name
email(string): Captain's email addressvehicle: (object):color(string): Vehicle colorplate(string): Vehicle platecapacity(number): Vehicle capacityvehicleType(string): Vehicle type
token(string): JWT token
Example:
{
"email": "jane.doe@example.com",
"token": "jwt-token"
}This endpoint is used to get the profile of the authenticated captain.
GET
/captain/profile
captain: (object):fullname: (object):firstname(string): Captain's first namelastname(string): Captain's last name
email(string): Captain's email addressvehicle: (object):color(string): Vehicle colorplate(string): Vehicle platecapacity(number): Vehicle capacityvehicleType(string): Vehicle type
Example:
{
"fullname": {
"firstname": "Jane",
"lastname": "Doe"
},
"email": "jane.doe@example.com",
"vehicle": {
"color": "red",
"plate": "ABC123",
"capacity": 4,
"vehicleType": "car"
}
}This endpoint is used to log out the authenticated captain.
POST
/captain/logout
message(string): Confirmation message Example:
{
"message": "Logged Out"
}