From dcff1c2d383ff73442e501794ffbc565204741a4 Mon Sep 17 00:00:00 2001 From: "Mr.MKZ" Date: Fri, 15 Nov 2024 22:47:52 +0330 Subject: [PATCH] docs(web): web document updated. --- docs/assets/navigation.js | 2 +- docs/assets/search.js | 2 +- docs/classes/AxonCore.html | 13 ++++++++----- docs/functions/Router.html | 2 +- docs/index.html | 13 +++++++++---- docs/interfaces/AxonCoreConfig.html | 4 ++-- docs/interfaces/AxonPlugin.html | 4 ++++ docs/interfaces/AxonResponseMessage.html | 8 ++++---- docs/interfaces/Headers.html | 2 +- docs/interfaces/Request.html | 14 +++++++------- docs/interfaces/Response.html | 6 +++--- docs/media/index.ts | 11 +++++++---- docs/modules.html | 1 + docs/types/Controller.html | 2 +- docs/types/Middleware.html | 2 +- docs/types/nextFn.html | 2 +- 16 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 docs/interfaces/AxonPlugin.html diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index c696708..9452a95 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAACoWRPQvCQAxA/0vmYrX42U0K4uLSVRyONtXDM1cvKVbE/+5wSmvVuublPQLZ3kCwFohhWVtKrEMIoFRygBgyo5iRwxcZHORkIICjphziUTS/Bx92YqnQ+6ahSdAVKmtl/Mp7LJpMO7EUubTEuEFmtcefxc5eX3aNKkfHX1NP1qeneK6Q5av+ZP26P/SH72FfILEkzhqDrknItUQOG9Lxh4vZaBK1Ghud5wYvqv1m32jIvwZhLSvq+n76z01tJe37i4oy0ZY49OTdn47vuwc9cxgUoQIAAA==" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAACoWSwY6CQAxA/6VnsihZdeW2ITF7MdlwNR4mUHDi2GGnJWKM/+5h3IAocO3re+mhuysINgIxfDeWEusQAqiUHCCGzChm5PCffBzkZCCAo6Yc4nn0dQte7MRSocu2oUnQFSrrZPzKcyxaLHuxX1OXmgZDHk9FUuTKEuMWmVWJg7Xe3lj2B1WOjt+mHmxMT/GvRpa3+oON6/7QAd/DsUBiSZw1Bl2bkEuFHLak58/Wq/ki6jS2Os8NnlX3V3yjJVMNwkY21Pf9dMpNbS3d+4uaMtGWOPTk2V9+3vZ32Cr90OYCAAA=" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index fba10be..35f106c 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAACqWZXW/iOBSG/4u59VDOgQDhrtNluittZ1ZFOzcRQikxbbQhZp3QdoT47yOTD9vYgGmv2mK/7zk+fjhO3B0R/K0gk2hH/kvzhEyGA0ryeM3IhDzybckEoWQrMjIhq22+LFOeFzfVQPelXGeEkmUWFwUryISQPW1sMBgqH/b/lhVla5TmJROreMmKm3rorBX0UOX0xJNfl4w69STlVhbJl7T4kuYvTKQlSwglm1iwvNSyOxFwE4t4XVwM2U77aFCzYMWG5wVzR63G/EtWlHG5PbECzavTzvNdQp2kCjsMgr5axWJR/tpcXkMdt9tO11bkCNet03RX7k8WJ0w4F1sPna8bjlur23ee33GhFlArbpqBs04BYOu05HlRiu2y5OK8Wcec6S5Em5dWgd5A5Z3xOLnj+Sp9vhDMmPjxWIdm4BGqmfexSM8Zf4qzhzRJMvYWX9qVjmP6B1eYFiXLLy2vmeQfQ2O2GT7aNA1dc4b/N/+P6dd/7z0NO83k82uokzwR8O8f9/fTR9+I7ezPh1z8nD5+/TGbXhdaU30mhcfp7J8f32fTxcN0Nru9n858s3AJr0zkGKSmTT6wooifnd3XMc0fqZyX3/g2T64x7mii08s7zvzUacbEKxNTIbRm6pODqft0GmtWvvDkOy9vs4y/sevq4RB/JCHshSMI1DmTs/fym+pV8jgtbqoPz27w2WPbculcOKjrLE6necfzUvAs0x4tqyBq4LPpHjldSlnL6HTajrOnCqYGPpv2kdOltLWM9nNK0jxh72SyI69MFCnPyYRgt98NCSWrlGWJfMqvwlOy5Ou1NKEk4cvt4dd5Pe0nk48fcnI1+6ZHaNSjGHbDYDSf06gRHwYOHzQe6pODEAiNwCUESwiGEAmN0CVES4iGsE9o1HcJ+5awbwgHhEYDl3BgCQeGMCA0ClzCwBIGhnBIaDSkMO6GIzCEQ0s4NIQjQqORK+LIEo4M4ZjQaOwSji3h2BCGhEahSxhawtAEQPIATnbAhgeO6Dng4+bHAZBJEEguwMkQ2BCBSRFINsDJEdgggUkSSD7AyRLYMIFJE0hGwMkT2ECBSRRITmDoFNtQgUkVSFbAyRXYYIFJFkhewMkW2HCBSRdIZsDJF9iAgUkYSmbQSRjahKFJGEpm0EkY2oThUY86NCl3l3K0KZMwlMygkzC0CUOTMBycah1oA4YmYCiRQSedaAOGJmB4smehzReafKEkBp1ko80Xmnzh+GRgG6/6o8OB+MpEyZK/qoMxitpTd0cW9WnZnsg7MiST3Z4SHNQ/m7/H8udenZmHT9tjU47J+PE7z5eH6wJlPlbm15ks61dBZQUD5QUDbzNRPzyum9cBzTHUHEMvx+peTVmgckAvA+N+Q/lomfglstQeIbV0tBph4GWUsKetWedAq4qfR3XXsNYeDzU7rUTgV6OX5gpLuYyUycjLo7mQ0BLpa4n0/Ux4nDhA7GlGPW8jUd3+aD6g+YCnz/OzueOgfX1heIXJ4pWJJ16YGWllBr86Vy9yOS/j5kVOo1H/dvhtvZsh1JBEv7zkO9jK2H/U9h/99j/n5ap6a9dstN1Hv91vbsaViZaKXyai+QeCtlnaXnl6NHfqykTrF34ttTFZ1P3UWBZo7R78+r2o/8OiTLT6+pW3utdg1b2GtlFagdCvQs39vzLRwPNohXNKNumGZWnOyCSa7/e/ATCoNXlcGgAA"; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAACqWZbW/iOBDHv4t5m6XMmPD0rttjeyddd1etbt9EFUqJ20YXYi4JbVcV3/1k8uAxNmDaV6B45j/j8c8Pcd5ZIV9LNove2b9pnrDZaBiwPF4JNmO3clOJggVsU2Rsxh43+bJKZV5e1A3952qVsYAts7gsRclmjG2DVgbDkdYR/21EWXVCaV6J4jFeivKiaToqBQPUOT3I5PcpoV5jpNWqMvmSll/S/FkUaSUSFrB1XIi8ItkdCLiOi3hVngzZmX00qFmwci3zUrij1m3+JSuruNoc6AHR6nV2vl1oktRhR2HIdS8Wi+r3+nQfmrj9zpz0yBGu36TprtyfIk5E4exs03S8bjjppC7fZH4lC92BxuOibTiqFAJ2SkuZl1WxWVayOC7WMy3dhejyIhUYDHXemYyTn9nmKc1PBDMMPx7rSuaP6ZNHrM7w47F2C49HqNbuY5GeMvkQZzdpkmTiNT5FQM9h/sEepmUlTo5aa+Qfg8yPtnlv0Mg0MS38V5k/5l//ufYU7LXGx/vQJHkg4N8/rq/nt74RO+vPh1z8mt9+/XE3Py808fpMCrfzu58/vt/NFzfzu7vL6/mdbxYuxzMT2QepXZJvRFnGT86V3mHmj1Quq29ykyfnCPeI0+Hu7Wd+aOcUxYso5kVBFm6fHEy/T6exEtWzTL7L6jLL5Ks4rx4O548khIPpGEK9p+Xirfqm1yq1dZcX9cOjA3z0iGCp9E4cCposDiO6txHuFaxuPQNI9XNaq9fYHa5zk9aBMC+iKFPpk3VPm54RzNh00jx1nsz3IzV2Z4UxkbmSeVXILCOvFPWA64bPorOndAofktHhtB3ngDqYbvhs2ntKp9ImGW3vA5bmiXhjs/eOmxnDPu9PWcAeU5El6u2uRXcpVyslErBELje7v/eN2S+hjp3KuLa+GLAgGgQc+sPp9P4+iFrnXcPuQauhn+wcgQURuBzBcgTDEVkQocsRLUc0HDkLIu5y5JYjNxyHLIiGLseh5Tg0HEMWRKHLMbQcQ8NxxIJoFOCgHwI3HEeW48hwHLMgGrsiji3HseE4YUE0cTlOLMeJ4ThlQTR1OU4tx6kJgOIBnOyADQ/s0bPDx82PAyCTIFBcgJMhsCECkyJQbICTI7BBApMkUHyAkyWwYQKTJlCMgJMnsIECkyhQnMDI6WxDBSZVoFgBJ1dggwUmWaB4ASdbYMMFJl2gmAEnX2ADBiZhqJhBJ2FoE4YmYaiYQSdhaBOGe2vUbpFyr1KOZcokDBUz6CQMbcLQJAwVM+gkDG3C0CQMw0PrDtqAoQkYKmTQSSfagKEJGCpk0Ekn2oChCRgqZNBJJ9qAoQkYKmTQSSfagKEJGN8B5qST24BxEzAOh4rNbb64yRdXxHAn2dzmi+/tg/xgYMdOWD/anSBeRFGJ5K/6JBFF3THlnS2a40V3hHlnIzZ73wYMw/qXQ/PL1e9WHzJ2T7tzhmpT8eM3mS9392pafKLFJ2eJLJt7DC0FodaC0Fts3bwoaCEkQjjyFiqaV6hV+1JMFAdEceClWN9kEwmi4CVg3ChqnanWmfrqdId3kg7R4X49SsTDxhwwQhb41bm+cVuRgzmR40TOj8jn9tJYq4y1yNhLo349IpUhSKNfidubPdKXIenL0E9ExoljUgARAm8he1IAQRj8BlwJFfV9LNEhIIMfyZl8ejLpAzJK4DdMtcjiRRQPsjQzIgMGfotQfbWSyypur1bI+BMM0Q9DN8+cVJz7Vap+1yO5kBmGfnVSFyuP5nJIWEQ/FnNZPdZXcUSGkIh+JLaf1khNSEm8JIr2CyQZbzLcnhrtRzktQmriV5JWZNFsD0a3gKym4LdmFM0nWi1CcPGbn/VlpagvK8lA0a3Gj7v2A6IWIVuo31bc3WeRRMgsR4+JeR+wdboWWZoLNovut9v/AVfvN33jHgAA"; \ No newline at end of file diff --git a/docs/classes/AxonCore.html b/docs/classes/AxonCore.html index 2fd3e24..eb3852a 100644 --- a/docs/classes/AxonCore.html +++ b/docs/classes/AxonCore.html @@ -1,15 +1,18 @@ -AxonCore | @mr-mkz/axon

Class AxonCore

Constructors

constructor +AxonCore | @mr-mkz/axon

Class AxonCore

Constructors

Methods

  • Parameters

    Returns Promise<void>

  • Start listening to http incoming requests

    +

Constructors

Methods

  • Start listening to http incoming requests

    Parameters

    • host: string = "127.0.0.1"

      server host address

    • port: number = 8000

      server port

    • Optionalcallback: (() => void)

      callback a function to run after starting to listen

      -
        • (): void
        • Returns void

    Returns Promise<void>

  • A method to config core as you want

    +
      • (): void
      • Returns void

Returns Promise<void>

  • A method to config core as you want

    If you want to config the core, use this method before all other methods.

    Parameters

    Returns void

  • loads created routes

    +

Returns Promise<void>

+
  • Optionalprefix: string
  • Returns Promise<void>

    diff --git a/docs/functions/Router.html b/docs/functions/Router.html index b3e17f7..69ba07b 100644 --- a/docs/functions/Router.html +++ b/docs/functions/Router.html @@ -1 +1 @@ -Router | @mr-mkz/axon

    Function Router

    • Returns AxonRouter

    +Router | @mr-mkz/axon

    Function Router

    diff --git a/docs/index.html b/docs/index.html index b86720e..6efcd53 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,6 +1,11 @@ @mr-mkz/axon

    @mr-mkz/axon

    Axon.js

    like the brain's powerful neural pathways, simple yet strong.

    Axon is a backend library who tries to be simple and powerfull.

    Currently Axon is 2X faster than Express. :D please checkout Axon Benchmarks

    +

    Latest change:

    +
      +
    • text/plain response in core default response errors bug fixed.
    • +
    • Plugin manager system added to core. (Document will update soon - 2024/10/24)
    • +

    Install Axon.js with npm

      npm install @mr-mkz/axon
     
    @@ -37,18 +42,18 @@

    • Simple routing system
    • -
    • Support methods: GET, POST, PUT, PATCH, DELETE, OPTIONS. more methods soon...
    • +
    • Support methods: GET, POST, PUT, PATCH, DELETE, OPTIONS.
    • Flexible routing system. (You can define routes in another files and then add them to core)
    • -
    • Default core logger (still developing)
    • +
    • Default core logger
    • Configurable core
    • +
    • Plugin manager (You can create your own plugins and use them in other projects)
    • +
    • Controllers and Middlewares

    More features soon...

    • Support controllers better than now.
    • -
    • Support middlewares.
    • Some changes in response structure.
    • Response meta generator.
    • -
    • Logger system. [In Progress]
    • Auto error detector (maybe)
    • Default schemas.
    • Default database connection methods.
    • diff --git a/docs/interfaces/AxonCoreConfig.html b/docs/interfaces/AxonCoreConfig.html index 3f9c139..f58334b 100644 --- a/docs/interfaces/AxonCoreConfig.html +++ b/docs/interfaces/AxonCoreConfig.html @@ -1,5 +1,5 @@ -AxonCoreConfig | @mr-mkz/axon

      Interface AxonCoreConfig

      interface AxonCoreConfig {
          DEBUG?: boolean;
          LOGGER?: boolean;
          LOGGER_VERBOSE?: boolean;
          RESPONSE_MESSAGES?: AxonResponseMessage;
      }

      Properties

      DEBUG? +AxonCoreConfig | @mr-mkz/axon

      Interface AxonCoreConfig

      interface AxonCoreConfig {
          DEBUG?: boolean;
          LOGGER?: boolean;
          LOGGER_VERBOSE?: boolean;
          RESPONSE_MESSAGES?: AxonResponseMessage;
      }

      Properties

      DEBUG?: boolean
      LOGGER?: boolean
      LOGGER_VERBOSE?: boolean
      RESPONSE_MESSAGES?: AxonResponseMessage
      +

      Properties

      DEBUG?: boolean
      LOGGER?: boolean
      LOGGER_VERBOSE?: boolean
      RESPONSE_MESSAGES?: AxonResponseMessage
      diff --git a/docs/interfaces/AxonPlugin.html b/docs/interfaces/AxonPlugin.html new file mode 100644 index 0000000..3ba997d --- /dev/null +++ b/docs/interfaces/AxonPlugin.html @@ -0,0 +1,4 @@ +AxonPlugin | @mr-mkz/axon

      Interface AxonPlugin

      interface AxonPlugin {
          name: string;
          version: string;
          init(core: AxonCore): void;
          [methodName: string]: any;
      }

      Indexable

      • [methodName: string]: any

      Properties

      Methods

      Properties

      name: string
      version: string

      Methods

      diff --git a/docs/interfaces/AxonResponseMessage.html b/docs/interfaces/AxonResponseMessage.html index 6e25304..7886ed0 100644 --- a/docs/interfaces/AxonResponseMessage.html +++ b/docs/interfaces/AxonResponseMessage.html @@ -1,4 +1,4 @@ -AxonResponseMessage | @mr-mkz/axon

      Interface AxonResponseMessage

      interface AxonResponseMessage {
          methodNotAllowed?: string;
          notFound?: string;
          serverError?: string;
          [key: string]: string | undefined;
      }

      Indexable

      • [key: string]: string | undefined

      Properties

      methodNotAllowed? +AxonResponseMessage | @mr-mkz/axon

      Interface AxonResponseMessage

      interface AxonResponseMessage {
          methodNotAllowed?: string;
          notFound?: string;
          serverError?: string;
          [key: string]: string | undefined;
      }

      Indexable

      • [key: string]: string | undefined

      Properties

      methodNotAllowed?: string

      response error message for 405 method not allowed response from core

      @@ -8,7 +8,7 @@
    • config: 'Method {method} is not allowed'
    • response: 'Method TRACE is not allowed'
    -
    notFound?: string

    response error message for 404 not found response from core

    +
    notFound?: string

    response error message for 404 not found response from core

    use {path} to show request method.

    -
    serverError?: string

    response error message for 500 internal server error response from core

    -
    +
    serverError?: string

    response error message for 500 internal server error response from core

    +
    diff --git a/docs/interfaces/Headers.html b/docs/interfaces/Headers.html index c22ba0e..5a92763 100644 --- a/docs/interfaces/Headers.html +++ b/docs/interfaces/Headers.html @@ -1,4 +1,4 @@ -Headers | @mr-mkz/axon

    Interface Headers

    interface Headers {
        accept?: string | string[];
        accept-charset?: string | string[];
        accept-encoding?: string | string[];
        accept-language?: string | string[];
        accept-ranges?: string;
        access-control-allow-credentials?: string;
        access-control-allow-headers?: string;
        access-control-allow-methods?: string;
        access-control-allow-origin?: string;
        access-control-expose-headers?: string;
        access-control-max-age?: string;
        access-control-request-headers?: string;
        access-control-request-method?: string;
        age?: string;
        allow?: string;
        authorization?: string;
        cache-control?: string;
        cdn-cache-control?: string;
        connection?: string | string[];
        content-disposition?: string;
        content-encoding?: string;
        content-language?: string;
        content-length?: string | number;
        content-location?: string;
        content-range?: string;
        content-security-policy?: string;
        content-security-policy-report-only?: string;
        cookie?: string | string[];
        date?: string;
        dav?: string | string[];
        dnt?: string;
        etag?: string;
        expect?: string;
        expires?: string;
        forwarded?: string;
        from?: string;
        host?: string;
        if-match?: string;
        if-modified-since?: string;
        if-none-match?: string;
        if-range?: string;
        if-unmodified-since?: string;
        last-modified?: string;
        link?: string | string[];
        location?: string;
        max-forwards?: string;
        origin?: string;
        prgama?: string | string[];
        proxy-authenticate?: string | string[];
        proxy-authorization?: string;
        public-key-pins?: string;
        public-key-pins-report-only?: string;
        range?: string;
        referer?: string;
        referrer-policy?: string;
        refresh?: string;
        retry-after?: string;
        sec-websocket-accept?: string;
        sec-websocket-extensions?: string | string[];
        sec-websocket-key?: string;
        sec-websocket-protocol?: string | string[];
        sec-websocket-version?: string;
        server?: string;
        set-cookie?: string | string[];
        strict-transport-security?: string;
        te?: string;
        trailer?: string;
        transfer-encoding?: string;
        upgrade?: string;
        upgrade-insecure-requests?: string;
        user-agent?: string;
        vary?: string;
        via?: string | string[];
        warning?: string;
        www-authenticate?: string | string[];
        x-content-type-options?: string;
        x-dns-prefetch-control?: string;
        x-frame-options?: string;
        x-xss-protection?: string;
    }

    Hierarchy

    • OutgoingHttpHeaders
      • Headers

    Properties

    accept? +Headers | @mr-mkz/axon

    Interface Headers

    interface Headers {
        accept?: string | string[];
        accept-charset?: string | string[];
        accept-encoding?: string | string[];
        accept-language?: string | string[];
        accept-ranges?: string;
        access-control-allow-credentials?: string;
        access-control-allow-headers?: string;
        access-control-allow-methods?: string;
        access-control-allow-origin?: string;
        access-control-expose-headers?: string;
        access-control-max-age?: string;
        access-control-request-headers?: string;
        access-control-request-method?: string;
        age?: string;
        allow?: string;
        authorization?: string;
        cache-control?: string;
        cdn-cache-control?: string;
        connection?: string | string[];
        content-disposition?: string;
        content-encoding?: string;
        content-language?: string;
        content-length?: string | number;
        content-location?: string;
        content-range?: string;
        content-security-policy?: string;
        content-security-policy-report-only?: string;
        cookie?: string | string[];
        date?: string;
        dav?: string | string[];
        dnt?: string;
        etag?: string;
        expect?: string;
        expires?: string;
        forwarded?: string;
        from?: string;
        host?: string;
        if-match?: string;
        if-modified-since?: string;
        if-none-match?: string;
        if-range?: string;
        if-unmodified-since?: string;
        last-modified?: string;
        link?: string | string[];
        location?: string;
        max-forwards?: string;
        origin?: string;
        prgama?: string | string[];
        proxy-authenticate?: string | string[];
        proxy-authorization?: string;
        public-key-pins?: string;
        public-key-pins-report-only?: string;
        range?: string;
        referer?: string;
        referrer-policy?: string;
        refresh?: string;
        retry-after?: string;
        sec-websocket-accept?: string;
        sec-websocket-extensions?: string | string[];
        sec-websocket-key?: string;
        sec-websocket-protocol?: string | string[];
        sec-websocket-version?: string;
        server?: string;
        set-cookie?: string | string[];
        strict-transport-security?: string;
        te?: string;
        trailer?: string;
        transfer-encoding?: string;
        upgrade?: string;
        upgrade-insecure-requests?: string;
        user-agent?: string;
        vary?: string;
        via?: string | string[];
        warning?: string;
        www-authenticate?: string | string[];
        x-content-type-options?: string;
        x-dns-prefetch-control?: string;
        x-frame-options?: string;
        x-xss-protection?: string;
    }

    Hierarchy

    • OutgoingHttpHeaders
      • Headers

    Properties

    accept? accept-charset? accept-encoding? accept-language? diff --git a/docs/interfaces/Request.html b/docs/interfaces/Request.html index c22e5fc..8ae26a8 100644 --- a/docs/interfaces/Request.html +++ b/docs/interfaces/Request.html @@ -1,4 +1,4 @@ -Request | @mr-mkz/axon

    Interface Request

    interface Request {
        aborted: boolean;
        body?: any;
        closed: boolean;
        complete: boolean;
        connection: Socket;
        destroyed: boolean;
        errored: null | Error;
        headers: IncomingHttpHeaders;
        headersDistinct: Dict<string[]>;
        httpVersion: string;
        httpVersionMajor: number;
        httpVersionMinor: number;
        method?: string;
        params: any;
        rawHeaders: string[];
        rawTrailers: string[];
        readable: boolean;
        readableAborted: boolean;
        readableDidRead: boolean;
        readableEncoding: null | BufferEncoding;
        readableEnded: boolean;
        readableFlowing: null | boolean;
        readableHighWaterMark: number;
        readableLength: number;
        readableObjectMode: boolean;
        socket: Socket;
        statusCode?: number;
        statusMessage?: string;
        trailers: Dict<string>;
        trailersDistinct: Dict<string[]>;
        url?: string;
        _construct?(callback: ((error?: null | Error) => void)): void;
        _destroy(error: null | Error, callback: ((error?: null | Error) => void)): void;
        _read(size: number): void;
        [asyncDispose](): Promise<void>;
        [asyncIterator](): AsyncIterableIterator<any>;
        [captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: AnyRest): void;
        addListener(event: "close", listener: (() => void)): this;
        addListener(event: "data", listener: ((chunk: any) => void)): this;
        addListener(event: "end", listener: (() => void)): this;
        addListener(event: "error", listener: ((err: Error) => void)): this;
        addListener(event: "pause", listener: (() => void)): this;
        addListener(event: "readable", listener: (() => void)): this;
        addListener(event: "resume", listener: (() => void)): this;
        addListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
        asIndexedPairs(options?: Pick<ArrayOptions, "signal">): Readable;
        compose<T>(stream:
            | ComposeFnParam
            | T
            | Iterable<T>
            | AsyncIterable<T>, options?: {
            signal: AbortSignal;
        }): T;
        destroy(error?: Error): this;
        drop(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
        emit(event: "close"): boolean;
        emit(event: "data", chunk: any): boolean;
        emit(event: "end"): boolean;
        emit(event: "error", err: Error): boolean;
        emit(event: "pause"): boolean;
        emit(event: "readable"): boolean;
        emit(event: "resume"): boolean;
        emit(event: string | symbol, ...args: any[]): boolean;
        eventNames(): (string | symbol)[];
        every(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>), options?: ArrayOptions): Promise<boolean>;
        filter(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>), options?: ArrayOptions): Readable;
        find<T>(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => data is T), options?: ArrayOptions): Promise<undefined | T>;
        find(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>), options?: ArrayOptions): Promise<any>;
        flatMap(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => any), options?: ArrayOptions): Readable;
        forEach(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => void | Promise<void>), options?: ArrayOptions): Promise<void>;
        getMaxListeners(): number;
        isPaused(): boolean;
        iterator(options?: {
            destroyOnReturn?: boolean;
        }): AsyncIterableIterator<any>;
        listenerCount<K>(eventName: string | symbol, listener?: Function): number;
        listeners<K>(eventName: string | symbol): Function[];
        map(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => any), options?: ArrayOptions): Readable;
        off<K>(eventName: string | symbol, listener: ((...args: any[]) => void)): this;
        on(event: "close", listener: (() => void)): this;
        on(event: "data", listener: ((chunk: any) => void)): this;
        on(event: "end", listener: (() => void)): this;
        on(event: "error", listener: ((err: Error) => void)): this;
        on(event: "pause", listener: (() => void)): this;
        on(event: "readable", listener: (() => void)): this;
        on(event: "resume", listener: (() => void)): this;
        on(event: string | symbol, listener: ((...args: any[]) => void)): this;
        once(event: "close", listener: (() => void)): this;
        once(event: "data", listener: ((chunk: any) => void)): this;
        once(event: "end", listener: (() => void)): this;
        once(event: "error", listener: ((err: Error) => void)): this;
        once(event: "pause", listener: (() => void)): this;
        once(event: "readable", listener: (() => void)): this;
        once(event: "resume", listener: (() => void)): this;
        once(event: string | symbol, listener: ((...args: any[]) => void)): this;
        pause(): this;
        pipe<T>(destination: T, options?: {
            end?: boolean;
        }): T;
        prependListener(event: "close", listener: (() => void)): this;
        prependListener(event: "data", listener: ((chunk: any) => void)): this;
        prependListener(event: "end", listener: (() => void)): this;
        prependListener(event: "error", listener: ((err: Error) => void)): this;
        prependListener(event: "pause", listener: (() => void)): this;
        prependListener(event: "readable", listener: (() => void)): this;
        prependListener(event: "resume", listener: (() => void)): this;
        prependListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
        prependOnceListener(event: "close", listener: (() => void)): this;
        prependOnceListener(event: "data", listener: ((chunk: any) => void)): this;
        prependOnceListener(event: "end", listener: (() => void)): this;
        prependOnceListener(event: "error", listener: ((err: Error) => void)): this;
        prependOnceListener(event: "pause", listener: (() => void)): this;
        prependOnceListener(event: "readable", listener: (() => void)): this;
        prependOnceListener(event: "resume", listener: (() => void)): this;
        prependOnceListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
        push(chunk: any, encoding?: BufferEncoding): boolean;
        rawListeners<K>(eventName: string | symbol): Function[];
        read(size?: number): any;
        reduce<T>(fn: ((previous: any, data: any, options?: Pick<ArrayOptions, "signal">) => T), initial?: undefined, options?: Pick<ArrayOptions, "signal">): Promise<T>;
        reduce<T>(fn: ((previous: T, data: any, options?: Pick<ArrayOptions, "signal">) => T), initial: T, options?: Pick<ArrayOptions, "signal">): Promise<T>;
        removeAllListeners(eventName?: string | symbol): this;
        removeListener(event: "close", listener: (() => void)): this;
        removeListener(event: "data", listener: ((chunk: any) => void)): this;
        removeListener(event: "end", listener: (() => void)): this;
        removeListener(event: "error", listener: ((err: Error) => void)): this;
        removeListener(event: "pause", listener: (() => void)): this;
        removeListener(event: "readable", listener: (() => void)): this;
        removeListener(event: "resume", listener: (() => void)): this;
        removeListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
        resume(): this;
        setEncoding(encoding: BufferEncoding): this;
        setMaxListeners(n: number): this;
        setTimeout(msecs: number, callback?: (() => void)): this;
        some(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>), options?: ArrayOptions): Promise<boolean>;
        take(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
        toArray(options?: Pick<ArrayOptions, "signal">): Promise<any[]>;
        unpipe(destination?: WritableStream): this;
        unshift(chunk: any, encoding?: BufferEncoding): void;
        wrap(stream: ReadableStream): this;
    }

    Hierarchy

    • IncomingMessage
      • Request

    Properties

    aborted +Request | @mr-mkz/axon

    Interface Request

    interface Request {
        aborted: boolean;
        body?: any;
        closed: boolean;
        complete: boolean;
        connection: Socket;
        destroyed: boolean;
        errored: null | Error;
        headers: IncomingHttpHeaders;
        headersDistinct: Dict<string[]>;
        httpVersion: string;
        httpVersionMajor: number;
        httpVersionMinor: number;
        method?: string;
        params: any;
        rawHeaders: string[];
        rawTrailers: string[];
        readable: boolean;
        readableAborted: boolean;
        readableDidRead: boolean;
        readableEncoding: null | BufferEncoding;
        readableEnded: boolean;
        readableFlowing: null | boolean;
        readableHighWaterMark: number;
        readableLength: number;
        readableObjectMode: boolean;
        socket: Socket;
        statusCode?: number;
        statusMessage?: string;
        trailers: Dict<string>;
        trailersDistinct: Dict<string[]>;
        url?: string;
        _construct?(callback: ((error?: null | Error) => void)): void;
        _destroy(error: null | Error, callback: ((error?: null | Error) => void)): void;
        _read(size: number): void;
        [asyncDispose](): Promise<void>;
        [asyncIterator](): AsyncIterableIterator<any, any, any>;
        [captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: AnyRest): void;
        addListener(event: "close", listener: (() => void)): this;
        addListener(event: "data", listener: ((chunk: any) => void)): this;
        addListener(event: "end", listener: (() => void)): this;
        addListener(event: "error", listener: ((err: Error) => void)): this;
        addListener(event: "pause", listener: (() => void)): this;
        addListener(event: "readable", listener: (() => void)): this;
        addListener(event: "resume", listener: (() => void)): this;
        addListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
        asIndexedPairs(options?: Pick<ArrayOptions, "signal">): Readable;
        compose<T>(stream:
            | ComposeFnParam
            | T
            | Iterable<T, any, any>
            | AsyncIterable<T, any, any>, options?: {
            signal: AbortSignal;
        }): T;
        destroy(error?: Error): this;
        drop(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
        emit(event: "close"): boolean;
        emit(event: "data", chunk: any): boolean;
        emit(event: "end"): boolean;
        emit(event: "error", err: Error): boolean;
        emit(event: "pause"): boolean;
        emit(event: "readable"): boolean;
        emit(event: "resume"): boolean;
        emit(event: string | symbol, ...args: any[]): boolean;
        eventNames(): (string | symbol)[];
        every(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>), options?: ArrayOptions): Promise<boolean>;
        filter(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>), options?: ArrayOptions): Readable;
        find<T>(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => data is T), options?: ArrayOptions): Promise<undefined | T>;
        find(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>), options?: ArrayOptions): Promise<any>;
        flatMap(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => any), options?: ArrayOptions): Readable;
        forEach(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => void | Promise<void>), options?: ArrayOptions): Promise<void>;
        getMaxListeners(): number;
        isPaused(): boolean;
        iterator(options?: {
            destroyOnReturn?: boolean;
        }): AsyncIterableIterator<any, any, any>;
        listenerCount<K>(eventName: string | symbol, listener?: Function): number;
        listeners<K>(eventName: string | symbol): Function[];
        map(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => any), options?: ArrayOptions): Readable;
        off<K>(eventName: string | symbol, listener: ((...args: any[]) => void)): this;
        on(event: "close", listener: (() => void)): this;
        on(event: "data", listener: ((chunk: any) => void)): this;
        on(event: "end", listener: (() => void)): this;
        on(event: "error", listener: ((err: Error) => void)): this;
        on(event: "pause", listener: (() => void)): this;
        on(event: "readable", listener: (() => void)): this;
        on(event: "resume", listener: (() => void)): this;
        on(event: string | symbol, listener: ((...args: any[]) => void)): this;
        once(event: "close", listener: (() => void)): this;
        once(event: "data", listener: ((chunk: any) => void)): this;
        once(event: "end", listener: (() => void)): this;
        once(event: "error", listener: ((err: Error) => void)): this;
        once(event: "pause", listener: (() => void)): this;
        once(event: "readable", listener: (() => void)): this;
        once(event: "resume", listener: (() => void)): this;
        once(event: string | symbol, listener: ((...args: any[]) => void)): this;
        pause(): this;
        pipe<T>(destination: T, options?: {
            end?: boolean;
        }): T;
        prependListener(event: "close", listener: (() => void)): this;
        prependListener(event: "data", listener: ((chunk: any) => void)): this;
        prependListener(event: "end", listener: (() => void)): this;
        prependListener(event: "error", listener: ((err: Error) => void)): this;
        prependListener(event: "pause", listener: (() => void)): this;
        prependListener(event: "readable", listener: (() => void)): this;
        prependListener(event: "resume", listener: (() => void)): this;
        prependListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
        prependOnceListener(event: "close", listener: (() => void)): this;
        prependOnceListener(event: "data", listener: ((chunk: any) => void)): this;
        prependOnceListener(event: "end", listener: (() => void)): this;
        prependOnceListener(event: "error", listener: ((err: Error) => void)): this;
        prependOnceListener(event: "pause", listener: (() => void)): this;
        prependOnceListener(event: "readable", listener: (() => void)): this;
        prependOnceListener(event: "resume", listener: (() => void)): this;
        prependOnceListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
        push(chunk: any, encoding?: BufferEncoding): boolean;
        rawListeners<K>(eventName: string | symbol): Function[];
        read(size?: number): any;
        reduce<T>(fn: ((previous: any, data: any, options?: Pick<ArrayOptions, "signal">) => T), initial?: undefined, options?: Pick<ArrayOptions, "signal">): Promise<T>;
        reduce<T>(fn: ((previous: T, data: any, options?: Pick<ArrayOptions, "signal">) => T), initial: T, options?: Pick<ArrayOptions, "signal">): Promise<T>;
        removeAllListeners(eventName?: string | symbol): this;
        removeListener(event: "close", listener: (() => void)): this;
        removeListener(event: "data", listener: ((chunk: any) => void)): this;
        removeListener(event: "end", listener: (() => void)): this;
        removeListener(event: "error", listener: ((err: Error) => void)): this;
        removeListener(event: "pause", listener: (() => void)): this;
        removeListener(event: "readable", listener: (() => void)): this;
        removeListener(event: "resume", listener: (() => void)): this;
        removeListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
        resume(): this;
        setEncoding(encoding: BufferEncoding): this;
        setMaxListeners(n: number): this;
        setTimeout(msecs: number, callback?: (() => void)): this;
        some(fn: ((data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>), options?: ArrayOptions): Promise<boolean>;
        take(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
        toArray(options?: Pick<ArrayOptions, "signal">): Promise<any[]>;
        unpipe(destination?: WritableStream): this;
        unshift(chunk: any, encoding?: BufferEncoding): void;
        wrap(stream: ReadableStream): this;
    }

    Hierarchy

    • IncomingMessage
      • Request

    Properties

    aborted body? closed complete @@ -81,7 +81,7 @@

    v10.1.0

    Since v17.0.0,v16.12.0 - Check message.destroyed from stream.Readable.

    body?: any

    the body of request which sent from client

    -
    closed: boolean

    Is true after 'close' has been emitted.

    +
    closed: boolean

    Is true after 'close' has been emitted.

    v18.0.0

    complete: boolean

    The message.complete property will be true if a complete HTTP message has been received and successfully parsed.

    @@ -137,7 +137,7 @@
    rawHeaders: string[]

    The raw request/response headers list exactly as they were received.

    +
    rawHeaders: string[]

    The raw request/response headers list exactly as they were received.

    The keys and values are in the same list. It is not a list of tuples. So, the even-numbered offsets are key values, and the odd-numbered offsets are the associated values.

    @@ -210,7 +210,7 @@

    v0.1.90

    Methods

    • Parameters

      • callback: ((error?: null | Error) => void)
          • (error?): void
          • Parameters

            • Optionalerror: null | Error

            Returns void

      Returns void

    • Parameters

      • error: null | Error
      • callback: ((error?: null | Error) => void)
          • (error?): void
          • Parameters

            • Optionalerror: null | Error

            Returns void

      Returns void

    • Parameters

      • size: number

      Returns void

    • Calls readable.destroy() with an AbortError and returns a promise that fulfills when the stream is finished.

      Returns Promise<void>

      v20.4.0

      -
    • Returns AsyncIterableIterator<any>

    • Type Parameters

      • K

      Parameters

      • error: Error
      • event: string | symbol
      • Rest...args: AnyRest

      Returns void

    • Event emitter +

    • Returns AsyncIterableIterator<any, any, any>

    • Type Parameters

      • K

      Parameters

      • error: Error
      • event: string | symbol
      • Rest...args: AnyRest

      Returns void

    • Event emitter The defined events on documents including:

      1. close
      2. @@ -239,7 +239,7 @@

      Parameters

      • Optionaloptions: Pick<ArrayOptions, "signal">

      Returns Readable

      a stream of indexed pairs.

      v17.5.0

      -
    • Type Parameters

      • T extends ReadableStream

      Parameters

      • stream:
            | ComposeFnParam
            | T
            | Iterable<T>
            | AsyncIterable<T>
      • Optionaloptions: {
            signal: AbortSignal;
        }
        • signal: AbortSignal

      Returns T

    • Calls destroy() on the socket that received the IncomingMessage. If error is provided, an 'error' event is emitted on the socket and error is passed +

    • Type Parameters

      • T extends ReadableStream

      Parameters

      • stream:
            | ComposeFnParam
            | T
            | Iterable<T, any, any>
            | AsyncIterable<T, any, any>
      • Optionaloptions: {
            signal: AbortSignal;
        }
        • signal: AbortSignal

      Returns T

    • Calls destroy() on the socket that received the IncomingMessage. If error is provided, an 'error' event is emitted on the socket and error is passed as an argument to any listeners on the event.

      Parameters

      • Optionalerror: Error

      Returns this

      v0.3.0

    • This method returns a new stream with the first limit chunks dropped from the start.

      @@ -357,13 +357,13 @@

      Returns boolean

      v0.11.14

      -
    • The iterator created by this method gives users the option to cancel the destruction +

    • The iterator created by this method gives users the option to cancel the destruction of the stream if the for await...of loop is exited by return, break, or throw, or if the iterator should destroy the stream if the stream emitted an error during iteration.

      Parameters

      • Optionaloptions: {
            destroyOnReturn?: boolean;
        }
        • OptionaldestroyOnReturn?: boolean

          When set to false, calling return on the async iterator, or exiting a for await...of iteration using a break, return, or throw will not destroy the stream. Default: true.

          -

      Returns AsyncIterableIterator<any>

      v16.3.0

      +

    Returns AsyncIterableIterator<any, any, any>

    v16.3.0

    • Returns the number of listeners listening for the event named eventName. If listener is provided, it will return how many times the listener is found in the list of the listeners of the event.

      diff --git a/docs/interfaces/Response.html b/docs/interfaces/Response.html index bc2b5aa..89b9a8a 100644 --- a/docs/interfaces/Response.html +++ b/docs/interfaces/Response.html @@ -1,4 +1,4 @@ -Response | @mr-mkz/axon

      Interface Response

      interface Response {
          chunkedEncoding: boolean;
          closed: boolean;
          connection: null | Socket;
          destroyed: boolean;
          errored: null | Error;
          finished: boolean;
          headersSent: boolean;
          req: IncomingMessage;
          sendDate: boolean;
          shouldKeepAlive: boolean;
          socket: null | Socket;
          status: ((code: number) => AxonResponse);
          statusCode: number;
          statusMessage: string;
          strictContentLength: boolean;
          useChunkedEncodingByDefault: boolean;
          writable: boolean;
          writableCorked: number;
          writableEnded: boolean;
          writableFinished: boolean;
          writableHighWaterMark: number;
          writableLength: number;
          writableNeedDrain: boolean;
          writableObjectMode: boolean;
          _construct?(callback: ((error?: null | Error) => void)): void;
          _destroy(error: null | Error, callback: ((error?: null | Error) => void)): void;
          _final(callback: ((error?: null | Error) => void)): void;
          _write(chunk: any, encoding: BufferEncoding, callback: ((error?: null | Error) => void)): void;
          _writev?(chunks: {
              chunk: any;
              encoding: BufferEncoding;
          }[], callback: ((error?: null | Error) => void)): void;
          [captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: AnyRest): void;
          addListener(event: "close", listener: (() => void)): this;
          addListener(event: "drain", listener: (() => void)): this;
          addListener(event: "error", listener: ((err: Error) => void)): this;
          addListener(event: "finish", listener: (() => void)): this;
          addListener(event: "pipe", listener: ((src: Readable) => void)): this;
          addListener(event: "unpipe", listener: ((src: Readable) => void)): this;
          addListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
          addTrailers(headers: OutgoingHttpHeaders | readonly [string, string][]): void;
          appendHeader(name: string, value: string | readonly string[]): this;
          assignSocket(socket: Socket): void;
          compose<T>(stream:
              | ComposeFnParam
              | T
              | Iterable<T>
              | AsyncIterable<T>, options?: {
              signal: AbortSignal;
          }): T;
          cork(): void;
          destroy(error?: Error): this;
          detachSocket(socket: Socket): void;
          emit(event: "close"): boolean;
          emit(event: "drain"): boolean;
          emit(event: "error", err: Error): boolean;
          emit(event: "finish"): boolean;
          emit(event: "pipe", src: Readable): boolean;
          emit(event: "unpipe", src: Readable): boolean;
          emit(event: string | symbol, ...args: any[]): boolean;
          end(cb?: (() => void)): this;
          end(chunk: any, cb?: (() => void)): this;
          end(chunk: any, encoding: BufferEncoding, cb?: (() => void)): this;
          eventNames(): (string | symbol)[];
          flushHeaders(): void;
          getHeader(name: string):
              | undefined
              | string
              | number
              | string[];
          getHeaderNames(): string[];
          getHeaders(): OutgoingHttpHeaders;
          getMaxListeners(): number;
          hasHeader(name: string): boolean;
          listenerCount<K>(eventName: string | symbol, listener?: Function): number;
          listeners<K>(eventName: string | symbol): Function[];
          off<K>(eventName: string | symbol, listener: ((...args: any[]) => void)): this;
          on(event: "close", listener: (() => void)): this;
          on(event: "drain", listener: (() => void)): this;
          on(event: "error", listener: ((err: Error) => void)): this;
          on(event: "finish", listener: (() => void)): this;
          on(event: "pipe", listener: ((src: Readable) => void)): this;
          on(event: "unpipe", listener: ((src: Readable) => void)): this;
          on(event: string | symbol, listener: ((...args: any[]) => void)): this;
          once(event: "close", listener: (() => void)): this;
          once(event: "drain", listener: (() => void)): this;
          once(event: "error", listener: ((err: Error) => void)): this;
          once(event: "finish", listener: (() => void)): this;
          once(event: "pipe", listener: ((src: Readable) => void)): this;
          once(event: "unpipe", listener: ((src: Readable) => void)): this;
          once(event: string | symbol, listener: ((...args: any[]) => void)): this;
          pipe<T>(destination: T, options?: {
              end?: boolean;
          }): T;
          prependListener(event: "close", listener: (() => void)): this;
          prependListener(event: "drain", listener: (() => void)): this;
          prependListener(event: "error", listener: ((err: Error) => void)): this;
          prependListener(event: "finish", listener: (() => void)): this;
          prependListener(event: "pipe", listener: ((src: Readable) => void)): this;
          prependListener(event: "unpipe", listener: ((src: Readable) => void)): this;
          prependListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
          prependOnceListener(event: "close", listener: (() => void)): this;
          prependOnceListener(event: "drain", listener: (() => void)): this;
          prependOnceListener(event: "error", listener: ((err: Error) => void)): this;
          prependOnceListener(event: "finish", listener: (() => void)): this;
          prependOnceListener(event: "pipe", listener: ((src: Readable) => void)): this;
          prependOnceListener(event: "unpipe", listener: ((src: Readable) => void)): this;
          prependOnceListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
          rawListeners<K>(eventName: string | symbol): Function[];
          removeAllListeners(eventName?: string | symbol): this;
          removeHeader(name: string): void;
          removeListener(event: "close", listener: (() => void)): this;
          removeListener(event: "drain", listener: (() => void)): this;
          removeListener(event: "error", listener: ((err: Error) => void)): this;
          removeListener(event: "finish", listener: (() => void)): this;
          removeListener(event: "pipe", listener: ((src: Readable) => void)): this;
          removeListener(event: "unpipe", listener: ((src: Readable) => void)): this;
          removeListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
          setDefaultEncoding(encoding: BufferEncoding): this;
          setHeader(name: string, value: string | number | readonly string[]): this;
          setMaxListeners(n: number): this;
          setTimeout(msecs: number, callback?: (() => void)): this;
          uncork(): void;
          write(chunk: any, callback?: ((error: undefined | null | Error) => void)): boolean;
          write(chunk: any, encoding: BufferEncoding, callback?: ((error: undefined | null | Error) => void)): boolean;
          writeContinue(callback?: (() => void)): void;
          writeEarlyHints(hints: Record<string, string | string[]>, callback?: (() => void)): void;
          writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
          writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
          writeProcessing(): void;
      }

      Hierarchy

      • ServerResponse
        • Response

      Properties

      chunkedEncoding +Response | @mr-mkz/axon

      Interface Response

      interface Response {
          chunkedEncoding: boolean;
          closed: boolean;
          connection: null | Socket;
          destroyed: boolean;
          errored: null | Error;
          finished: boolean;
          headersSent: boolean;
          req: IncomingMessage;
          sendDate: boolean;
          shouldKeepAlive: boolean;
          socket: null | Socket;
          status: ((code: number) => AxonResponse);
          statusCode: number;
          statusMessage: string;
          strictContentLength: boolean;
          useChunkedEncodingByDefault: boolean;
          writable: boolean;
          writableCorked: number;
          writableEnded: boolean;
          writableFinished: boolean;
          writableHighWaterMark: number;
          writableLength: number;
          writableNeedDrain: boolean;
          writableObjectMode: boolean;
          _construct?(callback: ((error?: null | Error) => void)): void;
          _destroy(error: null | Error, callback: ((error?: null | Error) => void)): void;
          _final(callback: ((error?: null | Error) => void)): void;
          _write(chunk: any, encoding: BufferEncoding, callback: ((error?: null | Error) => void)): void;
          _writev?(chunks: {
              chunk: any;
              encoding: BufferEncoding;
          }[], callback: ((error?: null | Error) => void)): void;
          [captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: AnyRest): void;
          addListener(event: "close", listener: (() => void)): this;
          addListener(event: "drain", listener: (() => void)): this;
          addListener(event: "error", listener: ((err: Error) => void)): this;
          addListener(event: "finish", listener: (() => void)): this;
          addListener(event: "pipe", listener: ((src: Readable) => void)): this;
          addListener(event: "unpipe", listener: ((src: Readable) => void)): this;
          addListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
          addTrailers(headers: OutgoingHttpHeaders | readonly [string, string][]): void;
          appendHeader(name: string, value: string | readonly string[]): this;
          assignSocket(socket: Socket): void;
          compose<T>(stream:
              | ComposeFnParam
              | T
              | Iterable<T, any, any>
              | AsyncIterable<T, any, any>, options?: {
              signal: AbortSignal;
          }): T;
          cork(): void;
          destroy(error?: Error): this;
          detachSocket(socket: Socket): void;
          emit(event: "close"): boolean;
          emit(event: "drain"): boolean;
          emit(event: "error", err: Error): boolean;
          emit(event: "finish"): boolean;
          emit(event: "pipe", src: Readable): boolean;
          emit(event: "unpipe", src: Readable): boolean;
          emit(event: string | symbol, ...args: any[]): boolean;
          end(cb?: (() => void)): this;
          end(chunk: any, cb?: (() => void)): this;
          end(chunk: any, encoding: BufferEncoding, cb?: (() => void)): this;
          eventNames(): (string | symbol)[];
          flushHeaders(): void;
          getHeader(name: string):
              | undefined
              | string
              | number
              | string[];
          getHeaderNames(): string[];
          getHeaders(): OutgoingHttpHeaders;
          getMaxListeners(): number;
          hasHeader(name: string): boolean;
          listenerCount<K>(eventName: string | symbol, listener?: Function): number;
          listeners<K>(eventName: string | symbol): Function[];
          off<K>(eventName: string | symbol, listener: ((...args: any[]) => void)): this;
          on(event: "close", listener: (() => void)): this;
          on(event: "drain", listener: (() => void)): this;
          on(event: "error", listener: ((err: Error) => void)): this;
          on(event: "finish", listener: (() => void)): this;
          on(event: "pipe", listener: ((src: Readable) => void)): this;
          on(event: "unpipe", listener: ((src: Readable) => void)): this;
          on(event: string | symbol, listener: ((...args: any[]) => void)): this;
          once(event: "close", listener: (() => void)): this;
          once(event: "drain", listener: (() => void)): this;
          once(event: "error", listener: ((err: Error) => void)): this;
          once(event: "finish", listener: (() => void)): this;
          once(event: "pipe", listener: ((src: Readable) => void)): this;
          once(event: "unpipe", listener: ((src: Readable) => void)): this;
          once(event: string | symbol, listener: ((...args: any[]) => void)): this;
          pipe<T>(destination: T, options?: {
              end?: boolean;
          }): T;
          prependListener(event: "close", listener: (() => void)): this;
          prependListener(event: "drain", listener: (() => void)): this;
          prependListener(event: "error", listener: ((err: Error) => void)): this;
          prependListener(event: "finish", listener: (() => void)): this;
          prependListener(event: "pipe", listener: ((src: Readable) => void)): this;
          prependListener(event: "unpipe", listener: ((src: Readable) => void)): this;
          prependListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
          prependOnceListener(event: "close", listener: (() => void)): this;
          prependOnceListener(event: "drain", listener: (() => void)): this;
          prependOnceListener(event: "error", listener: ((err: Error) => void)): this;
          prependOnceListener(event: "finish", listener: (() => void)): this;
          prependOnceListener(event: "pipe", listener: ((src: Readable) => void)): this;
          prependOnceListener(event: "unpipe", listener: ((src: Readable) => void)): this;
          prependOnceListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
          rawListeners<K>(eventName: string | symbol): Function[];
          removeAllListeners(eventName?: string | symbol): this;
          removeHeader(name: string): void;
          removeListener(event: "close", listener: (() => void)): this;
          removeListener(event: "drain", listener: (() => void)): this;
          removeListener(event: "error", listener: ((err: Error) => void)): this;
          removeListener(event: "finish", listener: (() => void)): this;
          removeListener(event: "pipe", listener: ((src: Readable) => void)): this;
          removeListener(event: "unpipe", listener: ((src: Readable) => void)): this;
          removeListener(event: string | symbol, listener: ((...args: any[]) => void)): this;
          setDefaultEncoding(encoding: BufferEncoding): this;
          setHeader(name: string, value: string | number | readonly string[]): this;
          setMaxListeners(n: number): this;
          setTimeout(msecs: number, callback?: (() => void)): this;
          uncork(): void;
          write(chunk: any, callback?: ((error: undefined | null | Error) => void)): boolean;
          write(chunk: any, encoding: BufferEncoding, callback?: ((error: undefined | null | Error) => void)): boolean;
          writeContinue(callback?: (() => void)): void;
          writeEarlyHints(hints: Record<string, string | string[]>, callback?: (() => void)): void;
          writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
          writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
          writeProcessing(): void;
      }

      Hierarchy

      • ServerResponse
        • Response

      Properties

      chunkedEncoding closed connection destroyed @@ -85,7 +85,7 @@

      v0.3.0

      status: ((code: number) => AxonResponse)

      to add http response code for client.

      Type declaration

        • (code): AxonResponse
        • Parameters

          • code: number

            http response code

            -

          Returns AxonResponse

      statusCode: number

      When using implicit headers (not calling response.writeHead() explicitly), +

    Returns AxonResponse

    statusCode: number

    When using implicit headers (not calling response.writeHead() explicitly), this property controls the status code that will be sent to the client when the headers get flushed.

    response.statusCode = 404;
    @@ -172,7 +172,7 @@ 

    Parameters

    • name: string

      Header name

    • value: string | readonly string[]

      Header value

    Returns this

    v18.3.0, v16.17.0

    -
    • Parameters

      • socket: Socket

      Returns void

    • Type Parameters

      • T extends ReadableStream

      Parameters

      • stream:
            | ComposeFnParam
            | T
            | Iterable<T>
            | AsyncIterable<T>
      • Optionaloptions: {
            signal: AbortSignal;
        }
        • signal: AbortSignal

      Returns T

    • The writable.cork() method forces all written data to be buffered in memory. +

    • Parameters

      • socket: Socket

      Returns void

    • Type Parameters

      • T extends ReadableStream

      Parameters

      • stream:
            | ComposeFnParam
            | T
            | Iterable<T, any, any>
            | AsyncIterable<T, any, any>
      • Optionaloptions: {
            signal: AbortSignal;
        }
        • signal: AbortSignal

      Returns T

    • The writable.cork() method forces all written data to be buffered in memory. The buffered data will be flushed when either the uncork or end methods are called.

      The primary intent of writable.cork() is to accommodate a situation in which several small chunks are written to the stream in rapid succession. Instead of diff --git a/docs/media/index.ts b/docs/media/index.ts index a668ce9..645dc32 100644 --- a/docs/media/index.ts +++ b/docs/media/index.ts @@ -5,11 +5,12 @@ import { AxonCore, Request, Response, nextFn } from "../src"; import { v1Routes } from "./routes/v1"; import { v2Routes } from "./routes/v2"; +import { LogPluginTest } from "./plugins/log"; const core = new AxonCore() core.loadConfig({ - DEBUG: true, // default false + DEBUG: false, // default false LOGGER: true, // default true LOGGER_VERBOSE: false, // default false RESPONSE_MESSAGES: { @@ -18,8 +19,6 @@ core.loadConfig({ }) const testMid = async (req: Request, res: Response, next: nextFn) => { - console.log("global middleware 1"); - next() } @@ -31,6 +30,10 @@ core.globalMiddleware(testMid); core.loadRoute(v1Routes) core.loadRoute(v2Routes, "/api/v1") +// using plugins for more flexible code and also using ready codes to develope faster than past. +// you can make your own plugins with AxonPlugin interface. +core.loadPlugin(new LogPluginTest()); + // callback function is optional and core has default log message for on start event // host default is 127.0.0.1 and port default is 8000 -core.listen("127.0.0.1", 8000) \ No newline at end of file +core.listen("127.0.0.1", 3000) \ No newline at end of file diff --git a/docs/modules.html b/docs/modules.html index 1b51ad0..c014c37 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -1,5 +1,6 @@ @mr-mkz/axon

      @mr-mkz/axon

      Index

      Classes

      Interfaces

      AxonCoreConfig +AxonPlugin AxonResponseMessage Headers Request diff --git a/docs/types/Controller.html b/docs/types/Controller.html index 0d08c7d..425df98 100644 --- a/docs/types/Controller.html +++ b/docs/types/Controller.html @@ -1 +1 @@ -Controller | @mr-mkz/axon

      Type Alias Controller

      Controller: ((req: Request, res: Response) => Promise<any>)
      +Controller | @mr-mkz/axon

      Type Alias Controller

      Controller: ((req: Request, res: Response) => Promise<any>)
      diff --git a/docs/types/Middleware.html b/docs/types/Middleware.html index 3be38b5..c19a190 100644 --- a/docs/types/Middleware.html +++ b/docs/types/Middleware.html @@ -1 +1 @@ -Middleware | @mr-mkz/axon

      Type Alias Middleware

      Middleware: ((req: Request, res: Response, next: nextFn) => Promise<any>)
      +Middleware | @mr-mkz/axon

      Type Alias Middleware

      Middleware: ((req: Request, res: Response, next: nextFn) => Promise<any>)
      diff --git a/docs/types/nextFn.html b/docs/types/nextFn.html index 432e998..33ce24e 100644 --- a/docs/types/nextFn.html +++ b/docs/types/nextFn.html @@ -1 +1 @@ -nextFn | @mr-mkz/axon

      Type Alias nextFn

      nextFn: (() => Promise<any>)
      +nextFn | @mr-mkz/axon

      Type Alias nextFn

      nextFn: (() => Promise<any>)