UNPKG

rjweb-server

Version:

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

24 lines (23 loc) 584 B
import ValueCollection from "../ValueCollection"; export default class ContentTypes { constructor() { this.data = new ValueCollection(); } /** * 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; } }