New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

s1

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

s1

Static server for SPA development

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

s1 – Static server for SPA development

The light and simple node-way static server with mod_rewrite. Best suitable for single-page apps development but can be used to host anything static.

Please, avoid using it in production.

Using

Install via npm (preferred globally).

npm -g install s1

Go to your project's public assets directory and run s1 executable.

cd app/public && s1

Now open localhost:8080 and enjoy your work.

CLI options

$ s1 --help
Usage: s1 [options]

Options:
  -h, --host, --ip      Host or IP to bind                  [default: "0.0.0.0"]
  -p, --port            Port                                     [default: 8080]
  -d, --dir, --root     Root directory                           [default: "./"]
  -i, --index           Index file                       [default: "index.html"]
  -c, --config, --conf  Config module                      [default: "./config"]
  --help                Show help                                      [boolean]

Config

The config is the basic Node.js module exporting object. It is located at s1's root directory, e.g., if installed globally in OS X /usr/local/lib/node_modules/s1/config.js.

You can have as many configs as you want, store it where you want, and pass needed one to the s1 using -c or --config cli switch.

For example:

s1 --config ~/myapps/config.app1.js

Config options

All config options except rewrite could be redefined from CLI.

NameTypeDefaultDescription
hostString0.0.0.0Host or interface's IP address s1 will be bound to. By default binds to ALL interfaces.
portNumber8080Binding port.
dirString./Root directory from which files will be hosted. Default to current directory.
indexStringindex.htmlIndex file name. Your app's entry.
rewriteArraybase rewriteArray with rules for mod_rewrite engine. s1 uses connect-modrewrite which rules are similiar to classic mod_rewrite in Nginx or Apache. You can use s1's options in rules using {{property}} syntax.

Contributing

The main purpose of the server is to stay tiny and easy to use in everyday development tasks. So if you got any use case you think is widely popular but poorly supported by s1 – feel free to tell me about it, or try to implement it yourself and send the PR.

Keywords

server

FAQs

Package last updated on 28 Jul 2023

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