npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ubio/ac-static-server

v5.1.2

Published

Server for static websites

Downloads

16

Readme

ubio AC Static server Actions Status

Server for static websites - This library intends to serve static files and provide a retrieve of configuration functionality over a HTTP request through an endpoint.

Features

  • Run static project backed by a server (Node.js application)
  • Exposes an endpoint to filter and provide configuration based on environment variables, from a static project
  • Let static project customize server arguments: exposed port and root folder to static files

Installation

Using npm package manager

npm install --save @ubio/ac-static-server

After installing locally, you can use the command line npx serve-static --path <FOLDER_TO_STATIC_FILES_PATH>

Commands

This CLI provides a few commands to get started.

Serving static files commands

| Command | Description | Required | | ------- | ------------------------------------------------------------------------------------------------------------------ | ------------------ | | port | Valid TCP port to run the server | No (default: 8081) | | path | Path to static files to be served. If static files not found, application will skip serving such files (only API). | Yes |

Exposed environment variables

Environment variables are exposed over a HTTP endpoint. A simple request to GET /api/StaticConfig/findConfigs and a JSON response will be given in the following format:

{
    "success": true,
    "data": {
        ...
    }
}

Although, variables must be defined for the environment where this application will be running (or simply through a .env file), they also need to be prepended with AC_PUBLIC_ENV_ to be considered as exposable by this API. For example, we could have the following variables defined for the current environment, when runnig this application:

NODE_ENV=production
PORT=8080
PATH=...
HOME=...
SHELL=...
AC_PUBLIC_ENV_API_URL=...
AC_PUBLIC_ENV_API_KEY=...
AC_PUBLIC_ENV_REPORT_API_KEY=...
AC_PUBLIC_ENV_REPORT_PROJECT_ID=...
AC_PUBLIC_ENV_VAULT_URL=...

We surely don't want to and it's meaningless for the served application (frontend project) to load such data. So, env variables will be filtered and the prefix of variables to be exposed will be removed from the their names, when formatting the response object. An example of the returned response, based on the previous variables defined, would be:

{
    "success": true,
    "data": {
        "API_URL": "...",
        "API_KEY": "...",
        "REPORT_API_KEY": "...",
        "REPORT_PROJECT_ID": "...",
        "VAULT_URL": "..."
    }
}

License

UBIO Limited © 2023