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

fixtureserver

v0.0.3

Published

A minimal testing server with eJS and ESI support

Downloads

2

Readme

fixtureserver

A minimalistic testing server to easily create and serve fixtures (i.e. "simple testing pages with dummy or mock content to run tests on"). Supports edge side includes (ESI) and embedded Javascript (eJS). Only intended for use within testing setups, pipelines or development!

Setup

Install via npm (global or local)

npm install -g fixtureserver

Then either start using commandline (and optionally pass --docroot, --host and --port as arguments) ...

fixtureserver --docroot=./your-docroot --host=localhost --port=9999

... or directly require and use within your node.js application as module

const fixtureserver = require('fixtureserver');

fixtureserver.start({
  docroot: './your-docroot',
  host: 'localhost',
  port: 9999,
});

Usage

Put HTML fixture files in your docroot, then start the server and open the default location (http://localhost:8000). The fixtures can use ESI statements as well as the full feature set of embeddedJS. A simple example might look like this:

  <!doctype html>
  <html>
  <body>
    Here we include some external file:
    <%- include('_header'); -%>

    The following is an edge side include:
    <esi:include src="http://example.com/some/remote/chunk.html" />

    Let's add some more fancy embedded Javascript (anyone feels reminded of PHP? ;) ..):
    <% if (server) { %>
      <i>server-esi v<%= server.version %></i>
    <% } %>

    <%- include('_footer'); -%>
  </body>

The include files _header.ejs and _footer.ejs (the extension is omitted in the include statement) are expected relative to the fixture's location. This makes it pretty convenient to serve a generic header or footer within your fixtures.

History

This tool is based on a very quick&dirty testing setup that we needed for functionally testing a set of server-side includes (SSI). We needed a setup that allowed us to run a functional test against the finally rendered and embedded includes. It should also handle some sort of dynamic scripting to allow stuff like includes and data mocking without too much repetition. This server does exactly that.

Why we chose ESI over SSI? SSIs may not contain a domain and therefore require a fairly complex setup using a local nginx as reverse proxy. That made everything unnecessarily complicated when just testing the integration. So we finally ditched the SSI in this setup (after wasting way too much time for 3 years).

License

MIT License, (c) Rico Pfaus 2018