Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

frock-static

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frock-static

A static file server for frock

  • 3.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

frock-static

A static file server plugin for frock, that can source its static files from interesting places.

Build Status npm install js-standard-style

A static file source can be:

  • A remote URL
  • A local directory of files
  • A single file

It's important to note that this is not a proxy; it doesn't pass any information about your request to the data source, nor does it modify the sourced data in any way.

frockfile Example

In your working directory, create a frockfile.js:

{
  "servers": [
    {
      "port": 8080,
      "routes": [
        {
          "path": "/api/people",
          "methods": ["GET"],
          "handler": "frock-static",
          "options": {
            "file": "fixtures/static/people.json",
            "contentType": "application/json"
          }
        },
        {
          "path": "/api/remote",
          "methods": ["GET"],
          "handler": "frock-static",
          "options": {
            "status": 201,
            "url": "http://paste.prod.urbanairship.com/raw/6255",
            "contentType": "application/json"
          }
        },
        {
          "path": "/api/static/*",
          "methods": ["GET"],
          "handler": "frock-static",
          "options": {
            "dir": "fixtures/static/",
            "baseUrl": "/api/static/"
          }
        }
      ]
    }
  ]
}

frock-static also supports a shorthand syntax, which is convenient for when you have to define a bunch of static sub-routes:

{
  "servers": [
    {
      "port": 6070,
      "routes": [
        {
          "path": "/api/resources/*",
          "methods": ["GET"],
          "handler": "frock-static",
          "options": {
            "routes": [
              {
                "path": "people",
                "file": "fixtures/static/people.json"
              },
              {
                "path": "places",
                "file": "fixtures/static/places.json"
              },
              {
                "path": "things",
                "url": "https://raw.github.com/someone/something/file.json"
              }
            ],
            "contentType": "application/json"
          }
        }
      ]
    }
  ]
}

License

Apache 2.0, see LICENSE for details.

FAQs

Package last updated on 24 Jul 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc