UNPKG

rjweb-server

Version:

Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS

30 lines (29 loc) 851 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const ValueCollection_1 = __importDefault(require("../ValueCollection")); class ContentTypes { constructor() { this.data = new ValueCollection_1.default(); } /** * Add A File -> Content Type Mapping * @example * ``` * const server = new Server(...) * * server.contentTypes((cT) => cT * .add('.png', 'image/png') * ) * ``` * @since 5.3.0 */ map( /** The File ending to apply this to */ ending, /** The Content Type to add to it */ contentType) { this.data.set(ending, contentType); return this; } } exports.default = ContentTypes;