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
| Export | Kind | Import from | Documented in |
|---|---|---|---|
HTTPError | class | core/errors/HTTPError.js | HTTPError |
Resource | class | core/http/Resource.js | Resource |
Status | const | core/http/response/Status.js | Status |
StatusCode | const | core/http/response/StatusCode.js | Status |
StatusDescription | const | core/http/response/StatusDescription.js | Status |
StatusName | const | core/http/response/StatusName.js | Status |
Header | const | core/http/Header.js | Header |
Method | const | core/http/request/Method.js | Method |
IBuilder | interface | core/interfaces/IBuilder.js | Types |
IHandler | interface | core/interfaces/IHandler.js | Types |
MethodOf | type | core/types/MethodOf.js | Types |
RequestMethod | type | core/types/RequestMethod.js | Types |
ResponseStatus | type | core/types/ResponseStatus.js | Types |
ResponseStatusCode | type | core/types/ResponseStatusCode.js | Types |
ResponseStatusDescription | type | core/types/ResponseStatusDescription.js | Types |
ResponseStatusName | type | core/types/ResponseStatusName.js | Types |
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.