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

@foxify/config

v1.1.0

Published

Foxify Configuration

Downloads

8

Readme

Foxify Config

Test CodeCov

Foxify Configuration

Table of Content

Installation

In case of using GitHub package registry, the package name will be @foxifyjs/config.

NPM

npm i @foxify/config

PNPM

pnpm add @foxify/config

Yarn

yarn add @foxify/config

Usage

Create the foxify.config.js file at the root of your project. (Optional)

In case of the config file missing, the default values will be used.

| Config | Type | Default | Description | |:------------------:|:--------------------------------------------------------------:|:---------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------:| | env | production, development, test | process.env.NODE_ENV or development | Node.js environment. | | xPoweredBy | Boolean | true | Indicates whether the X-Powered-By header should be present or not. | | workers | Integer between 1 and number of cpu cores | 1 | Number of Node.js cluster workers to be created. In case of 1 Node.js cluster workers won't be used. | | etag | (body: string / Buffer, encoding?: BufferEncoding) => string | - | ETag response header value generator. | | server | Object | - | Server config. | | server.protocol | http, https | http | Server protocol. | | server.hostname | String | localhost | Server hostname. | | server.port | Integer between 0 and 65535 | 3000 | Server port. | | subdomain | Object | - | Subdomain config. | | subdomain.offset | Non-negative integer | 2 | The number of dot-separated parts of the host to remove to access subdomain. | | json | Object | - | JSON config. | | json.escape | Boolean | false | Enable escaping JSON responses from the res.json, res.jsonp, and res.send APIs. | | json.replacer | (key: string, value: unknown) => unknown | - | The replacer argument used by JSON.stringify. | | json.spaces | Non-negative integer | 0 | The space argument used by JSON.stringify. This is typically set to the number of spaces to use to indent prettified JSON. | | jsonp | Object | - | JSONP config. | | jsonp.callback | String | callback | The JSONP callback name. | | query | Object | - | Request query string config. | | query.parser | (queryString: string) => Record<string, any> | qs.parse | A custom query string parsing function will receive the complete query string, and must return an object of query keys and their values. | | proxy | Object | - | Proxy config. | | proxy.trust | (ip: string, hopIndex: number) => boolean | () => false | Indicates whether the app is behind a front-facing proxy, and to use the X-Forwarded-* headers to determine the connection and the IP address of the client. |

The exported config values are frozen using Object.freeze.

ECMAScript

Config file contents (foxify.config.js):

export default {
  env: "development",
  xPoweredBy: true,
  workers: 1,
  server: {
    protocol: "http",
    hostname: "localhost",
    port: 3000,
  },
  subdomain: {
    offset: 2,
  },
  json: {
    escape: false,
    spaces: 0,
  },
  jsonp: {
    callback: "callback",
  },
  query: {
    parser: qs.parse,
  },
  proxy: {
    trust: () => false,
  },
};

Consume the config values:

import config from "@foxify/config";

CommonJS

Config file contents (foxify.config.js):

module.exports = {
  env: "development",
  xPoweredBy: true,
  workers: 1,
  server: {
    protocol: "http",
    hostname: "localhost",
    port: 3000,
  },
  subdomain: {
    offset: 2,
  },
  json: {
    escape: false,
    spaces: 0,
  },
  jsonp: {
    callback: "callback",
  },
  query: {
    parser: qs.parse,
  },
  proxy: {
    trust: () => false,
  },
};

Consume the config values:

const config = require("@foxify/config").default;

Versioning

We use SemVer for versioning. For the versions available, see the releases on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details