NAV -image
javascript bash

Introduction

This documentation aims to provide all the information you need to work with our API.

Base URL:

http://127.0.0.1:3333

Authenticating requests

Authenticate requests to this API's endpoints by sending an Authorization header with the value "Bearer YOUR_TOKEN".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

To get an auth token, create a user via /signup, then use the /login endpoint to get an auth token.

Endpoints

Handles user signup

Example request:

const url = new URL(
    "http://127.0.0.1:3333/signup"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "ea",
    "username": "officia",
    "email": "vitae",
    "password": "reiciendis"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(body),
})
.then(response => response.json())
.then(json => console.log(json));
curl -X POST \
    "http://127.0.0.1:3333/signup"  \
    -d '{"name":"ea","username":"officia","email":"vitae","password":"reiciendis"}'

Example response (400):

{"status":"error","message":"There was a problem creating the user, please try again later."}

Request   

POST /signup

Body Parameters

name  string optional

username  string

email  string

password  string

Handles user authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/login"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "molestiae",
    "password": "quasi"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(body),
})
.then(response => response.json())
.then(json => console.log(json));
curl -X POST \
    "http://127.0.0.1:3333/login"  \
    -d '{"email":"molestiae","password":"quasi"}'

Example response (200):

{
   "status": "success",
   "data": "YOUR_TOKEN"
 }

Request   

POST /login

Body Parameters

email  string

password  string

Get details of the currently authenticated user

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/account/me"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer Vga81Pb6f4Eh6ek35vZcaDd",
};


fetch(url, {
    method: "GET",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X GET \
    -G "http://127.0.0.1:3333/account/me" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":242,"column":7,"context":{"start":237,"pre":"    /**\n     * Don't bother when request does not have body\n     */\n    if (!request.hasBody()) {\n      debug('skipping body parsing, since request body is empty')","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is multipart/form-data and autoProcess is set to"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

GET /account/me

Update user profile

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/account/update_profile"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer 4ebV1kDg3hvdPa56Zc8E6af",
};


fetch(url, {
    method: "PUT",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X PUT \
    "http://127.0.0.1:3333/account/update_profile" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"internal/process/task_queues.js","filePath":"internal/process/task_queues.js","method":"processTicksAndRejections","line":93,"column":5,"context":{},"isModule":false,"isNative":true,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":284,"column":7,"context":{"start":279,"pre":"      const { parsed, raw } = await this._parseJSON(request.request)\n\n      request.body = parsed\n      request._raw = raw\n","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is Url encoded form, so parse it and move forward"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

PUT /account/update_profile

Change user password

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/account/change_password"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer c4bDVaZ8dgk13E65Paefhv6",
};


fetch(url, {
    method: "PUT",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X PUT \
    "http://127.0.0.1:3333/account/change_password" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"internal/process/task_queues.js","filePath":"internal/process/task_queues.js","method":"processTicksAndRejections","line":93,"column":5,"context":{},"isModule":false,"isNative":true,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":284,"column":7,"context":{"start":279,"pre":"      const { parsed, raw } = await this._parseJSON(request.request)\n\n      request.body = parsed\n      request._raw = raw\n","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is Url encoded form, so parse it and move forward"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

PUT /account/change_password

Fetch user and followers tweets

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/users/timeline"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer ka4c56861Dde3gfahbEPVZv",
};


fetch(url, {
    method: "GET",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X GET \
    -G "http://127.0.0.1:3333/users/timeline" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":242,"column":7,"context":{"start":237,"pre":"    /**\n     * Don't bother when request does not have body\n     */\n    if (!request.hasBody()) {\n      debug('skipping body parsing, since request body is empty')","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is multipart/form-data and autoProcess is set to"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

GET /users/timeline

Users to follow

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/users/users_to_follow"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer h6kb3ada5DeV41f68EcPZvg",
};


fetch(url, {
    method: "GET",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X GET \
    -G "http://127.0.0.1:3333/users/users_to_follow" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":242,"column":7,"context":{"start":237,"pre":"    /**\n     * Don't bother when request does not have body\n     */\n    if (!request.hasBody()) {\n      debug('skipping body parsing, since request body is empty')","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is multipart/form-data and autoProcess is set to"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

GET /users/users_to_follow

Follow a user

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/users/follow"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer veDVfhPkE8caba16d365gZ4",
};


fetch(url, {
    method: "POST",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X POST \
    "http://127.0.0.1:3333/users/follow" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"internal/process/task_queues.js","filePath":"internal/process/task_queues.js","method":"processTicksAndRejections","line":93,"column":5,"context":{},"isModule":false,"isNative":true,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":284,"column":7,"context":{"start":279,"pre":"      const { parsed, raw } = await this._parseJSON(request.request)\n\n      request.body = parsed\n      request._raw = raw\n","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is Url encoded form, so parse it and move forward"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

POST /users/follow

Unfollow a user

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/users/unfollow/58251"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer 4k6vbcVa38hgaDeP6fdE51Z",
};


fetch(url, {
    method: "DELETE",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X DELETE \
    "http://127.0.0.1:3333/users/unfollow/58251" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"internal/process/task_queues.js","filePath":"internal/process/task_queues.js","method":"processTicksAndRejections","line":93,"column":5,"context":{},"isModule":false,"isNative":true,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":242,"column":7,"context":{"start":237,"pre":"    /**\n     * Don't bother when request does not have body\n     */\n    if (!request.hasBody()) {\n      debug('skipping body parsing, since request body is empty')","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is multipart/form-data and autoProcess is set to"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

DELETE /users/unfollow/:id

URL Parameters

id  number

Post a tweet

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/tweet"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer 686fEaa4PZgehdvDc53bk1V",
};


fetch(url, {
    method: "POST",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X POST \
    "http://127.0.0.1:3333/tweet" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"internal/process/task_queues.js","filePath":"internal/process/task_queues.js","method":"processTicksAndRejections","line":93,"column":5,"context":{},"isModule":false,"isNative":true,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":284,"column":7,"context":{"start":279,"pre":"      const { parsed, raw } = await this._parseJSON(request.request)\n\n      request.body = parsed\n      request._raw = raw\n","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is Url encoded form, so parse it and move forward"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

POST /tweet

Fetch a tweet

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/tweets/77714"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer 8a5dvePk63DaV6hZbE4gcf1",
};


fetch(url, {
    method: "GET",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X GET \
    -G "http://127.0.0.1:3333/tweets/77714" 

Example response (404):

{"status":"error","message":"Tweet not found"}

Request   

GET /tweets/:id

URL Parameters

id  number

Reply a tweet

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/tweets/reply/6181"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer 6f8adbZPcvk3ha16Eg4DeV5",
};


fetch(url, {
    method: "POST",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X POST \
    "http://127.0.0.1:3333/tweets/reply/6181" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"internal/process/task_queues.js","filePath":"internal/process/task_queues.js","method":"processTicksAndRejections","line":93,"column":5,"context":{},"isModule":false,"isNative":true,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":284,"column":7,"context":{"start":279,"pre":"      const { parsed, raw } = await this._parseJSON(request.request)\n\n      request.body = parsed\n      request._raw = raw\n","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is Url encoded form, so parse it and move forward"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

POST /tweets/reply/:id

URL Parameters

id  number

Delete a tweet

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/tweets/destroy/84883"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer ZcaEe68a5dvhP1Df3V4g6kb",
};


fetch(url, {
    method: "DELETE",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X DELETE \
    "http://127.0.0.1:3333/tweets/destroy/84883" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"internal/process/task_queues.js","filePath":"internal/process/task_queues.js","method":"processTicksAndRejections","line":93,"column":5,"context":{},"isModule":false,"isNative":true,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":242,"column":7,"context":{"start":237,"pre":"    /**\n     * Don't bother when request does not have body\n     */\n    if (!request.hasBody()) {\n      debug('skipping body parsing, since request body is empty')","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is multipart/form-data and autoProcess is set to"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

DELETE /tweets/destroy/:id

URL Parameters

id  number

Favorite a specified tweet

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/favorites/create"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer VvDegh8abP1Zc6a3f6kd45E",
};


fetch(url, {
    method: "POST",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X POST \
    "http://127.0.0.1:3333/favorites/create" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"internal/process/task_queues.js","filePath":"internal/process/task_queues.js","method":"processTicksAndRejections","line":93,"column":5,"context":{},"isModule":false,"isNative":true,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":284,"column":7,"context":{"start":279,"pre":"      const { parsed, raw } = await this._parseJSON(request.request)\n\n      request.body = parsed\n      request._raw = raw\n","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is Url encoded form, so parse it and move forward"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

POST /favorites/create

Unfavorite a specified tweet

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/favorites/destroy/54467"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer kEdPb6843h5fDaeVa6Zvgc1",
};


fetch(url, {
    method: "DELETE",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X DELETE \
    "http://127.0.0.1:3333/favorites/destroy/54467" 

Example response (401):

{"error":{"message":"E_INVALID_JWT_TOKEN: jwt malformed","name":"InvalidJwtToken","status":401,"frames":[{"file":"node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Exceptions\\index.js","method":"Function.invoke","line":222,"column":12,"context":{"start":217,"pre":" *\n * @class InvalidJwtToken\n */\nclass InvalidJwtToken extends GE.LogicalException {\n  static invoke (message) {","line":"    return new this(message || 'The Jwt token is invalid', 401, 'E_INVALID_JWT_TOKEN')","post":"  }\n}\n\n/**\n * This exception is raised when jwt refresh token is"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Schemes\\Jwt.js","method":"JwtScheme.check","line":402,"column":32,"context":{"start":397,"pre":"      this.jwtPayload = await this._verifyToken(token)\n    } catch ({ name, message }) {\n      if (name === 'TokenExpiredError') {\n        throw CE.ExpiredJwtToken.invoke()\n      }","line":"      throw CE.InvalidJwtToken.invoke(message)","post":"    }\n\n    this.user = await this._serializerInstance.findById(this.jwtPayload.uid)\n\n    /**"},"isModule":true,"isNative":false,"isApp":false},{"file":"internal/process/task_queues.js","filePath":"internal/process/task_queues.js","method":"processTicksAndRejections","line":93,"column":5,"context":{},"isModule":false,"isNative":true,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth._authenticate","line":67,"column":9,"context":{"start":62,"pre":"     * via anyone\n     */\n    for (const scheme of schemes) {\n      try {\n        const authenticator = auth.authenticator(scheme)","line":"        await authenticator.check()","post":"\n        debug('authenticated using %s scheme', scheme)\n\n        /**\n         * Swapping the main authentication instance with the one using which user"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\auth\\src\\Middleware\\Auth.js","method":"async Auth.handle","line":109,"column":5,"context":{"start":104,"pre":"   *                             If no scheme is defined, then default scheme from config is used.\n   *\n   * @return {void}\n   */\n  async handle ({ auth, view }, next, schemes) {","line":"    await this._authenticate(auth, schemes)","post":"\n    /**\n     * For compatibility with the old API\n     */\n    auth.current = auth.authenticatorInstance"},"isModule":true,"isNative":false,"isApp":false},{"file":"node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","filePath":"C:\\Users\\shalvah\\Projects\\Temp\\tweetr-api\\node_modules\\@adonisjs\\bodyparser\\src\\BodyParser\\index.js","method":"async BodyParser.handle","line":242,"column":7,"context":{"start":237,"pre":"    /**\n     * Don't bother when request does not have body\n     */\n    if (!request.hasBody()) {\n      debug('skipping body parsing, since request body is empty')","line":"      await next()","post":"      return\n    }\n\n    /**\n     * Body is multipart/form-data and autoProcess is set to"},"isModule":true,"isNative":false,"isApp":false}]}}

Request   

DELETE /favorites/destroy/:id

URL Parameters

id  number

Show user profile

requires authentication

Example request:

const url = new URL(
    "http://127.0.0.1:3333/eaque"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer Z3aPcfEDde4a815g6Vv6bhk",
};


fetch(url, {
    method: "GET",
    headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
curl -X GET \
    -G "http://127.0.0.1:3333/eaque" 

Example response (404):

{"status":"error","message":"User not found"}

Request   

GET /:username

URL Parameters

username  string