Socket
Book a DemoInstallSign in
Socket

@hatsy/serve-static

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hatsy/serve-static

Hatsy request handler that serves static content

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
1
Created
Source

Static Content Handler

NPM Build Status Code Quality Coverage GitHub Project API Documentation

serveStatic()

This module contains a serveStatic() factory of request handler able to serve static content.

It is based on send and can be configured with similar options.

import { httpListener } from '@hatsy/hatsy';
import { dispatchByName, Routing } from '@hatsy/router';
import { serveStatic } from '@hatsy/serve-static';
import { createServer } from 'http';

const server = createServer(
  httpListener(
    Routing.for(
      dispatchByName({
        assets: serveStatic('static_html/assets', { extensions: ['png', 'jpeg', 'gif'] }),
      }),
    ),
  ),
);

server.listen(8080);

Keywords

http-middleware

FAQs

Package last updated on 17 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts