Skip to Content
Drash v3 is in beta. APIs may change.
ReferenceCoreOverview

Core

The lowest layer. Core holds types, interfaces, enums, the base Resource class, and HTTPError. It imports nothing else in the codebase, so anything here can be used on its own.

Core carries almost no behavior. HTTPError and Resource are the only two exports that do anything at runtime, and what Resource does is throw.

Exports

ExportKindImport fromDocumented in
HTTPErrorclasscore/errors/HTTPError.jsHTTPError
Resourceclasscore/http/Resource.jsResource
Statusconstcore/http/response/Status.jsStatus
StatusCodeconstcore/http/response/StatusCode.jsStatus
StatusDescriptionconstcore/http/response/StatusDescription.jsStatus
StatusNameconstcore/http/response/StatusName.jsStatus
Headerconstcore/http/Header.jsHeader
Methodconstcore/http/request/Method.jsMethod
IBuilderinterfacecore/interfaces/IBuilder.jsTypes
IHandlerinterfacecore/interfaces/IHandler.jsTypes
MethodOftypecore/types/MethodOf.jsTypes
RequestMethodtypecore/types/RequestMethod.jsTypes
ResponseStatustypecore/types/ResponseStatus.jsTypes
ResponseStatusCodetypecore/types/ResponseStatusCode.jsTypes
ResponseStatusDescriptiontypecore/types/ResponseStatusDescription.jsTypes
ResponseStatusNametypecore/types/ResponseStatusName.jsTypes

Every path above is a subpath of @drashland/drash. There are two aggregate modules as well — core/Interfaces.js and core/Types.js — which re-export the interfaces and types above so you can pull several from one specifier.

What You Actually Import

Most of Core reaches you through the HTTP module rather than directly. HTTPError and Resource are both re-exported by modules/http.native.js and modules/http.polyfill.js, so a normal app imports them from there.

Status is the exception worth knowing: it is not re-exported, and HTTPError requires it. That import is:

import { Status } from "@drashland/drash/core/http/response/Status.js";

See Modules > HTTP > Native vs. Polyfill for the full re-export list in the HTTP module.

Last updated on