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

zab

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zab

A static web server for the masses.

  • 0.1.0
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Zab

Zab is a static web server for the masses. Many simple but sexy features are built in including clean URLs, templates, simple content management, and much more to come.

Installation

npm install -g zab

or for package.json support

npm install --save zab

Setup

Create a new project folder (or use an existing project) and use the CLI to initialize.

zab new

You can also run the Zab server to work magic locally.

zab server

Config

The config file can be used to customize your server. It can be found at your-website/zab/config.json.

  • root Sets the root folder of your project (where your index.html lives). Defaults to the project directory.
  • errorPage Sets the error page used whenever a 404 error is thrown in your application. Will default to Zab's 404 page.
  • indexPage Sets the default index file used if something other than index.html (for whatever reasons you have). Defaults to index.html.
  • cleanUrls If set to true, Zab will serve all pages without the extension, and will automatically redirect urls with extensions. Defaults to true.
  • redirect An object containing your redirects. Supports URL parameters, and will correctly forward them to the new page using a 301. You can also specify the status. Example:
{
  ...
  "redirect": {
    "/old/path": "/new/path",
    "/old/path/:param": "/new/path/:param",
    "/another/old/path": {
      "status": 302,
      "url": "/new/temporary/page"
    }
  }
  ...
}
  • protect If set to true, Zab will take extra measures to ensure your app's security such as XSS protection and adding extra security headers. Defaults to true.
  • gzip If set to true, Zab will gzip the response body. Defaults to false.
  • host The host used by the server. Defaults to localhost.
  • port The port used by the server. Defaults to 6219. Note: Node's PORT environment variable will take priority (set by PaaS like Heroku).

CMS and Partials

You can use partials and simple mustache values in your pages, and they will automatically be rendered. Awesome!

To use the basic CMS, you can edit the JSON file at your-website/zab/data.json, and use those values anywhere in your HTML files. Example:

{
  "heading": "Welcome to Zab!",
  "name": "Jason Maurer"
}
<h1>{{heading}}</h1>
<p>Hello, my name is {{name}}!</p>

To use a partial, simply point to it in your HTML file using the Mustache format.

{{> path/to/partial.html}}

Tests

No tests have been written yet. I know, terrible me. Stay tuned...

Contributing

This is still an early prototype, but we have big plans for Zab in the near future. If you want to contribute or be a part of it, visit us at zab.io for more info, and be sure to sign up for our mailing list. We're also happy to review any pull requests!

Copyright © 2015 Zab · Licensed under the MIT license.

FAQs

Package last updated on 25 Aug 2015

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