• Stars
    star
    100
  • Rank 340,703 (Top 7 %)
  • Language
    JavaScript
  • License
    Other
  • Created almost 15 years ago
  • Updated about 13 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Static HTTP server built on node.js

Antinode is a simple static file webserver built on node.js.

Usage

Run it from the command line.

$ node server.js [settings.json]

Requires Node.JS v0.1.100 or greater. If you want to bind to a port under 1024, you'll need to run node with special privileges.

Configuration

Configuration is through a JSON text file, by default the settings.json in the same folder as server.js.

Example settings file:

{
    "port" : 8080,
    "hosts" : {
        "subdomain1.example.com" : { 
            "root" : "/www/subdomain1/"
        },
        "subdomain2.example.com" : {
            "root" : "/www/subdomain2/"
        }
        },
    "default_host" : {
        "root" : "/www/default/"
    }
}

This server listens on port 8080 for HTTP requests. If it gets a request for Host: subdomain1.example.com the site will serve /www/subdomain1/, and similarly requests for Host: subdomain2.example.com will respond with the files from /www/subdomain2. If the Host header does not match either, or is not given, antinode will serve files from /www/default.

Explanation of properties:

  • port - the port to listen for HTTP connections on. default: 8080
  • hosts - an object with one property name per virtual host address, with the value of a 'virtual host' object to
  • default_host - the 'virtual host' object to default to if no other virtual hosts match, or the HTTP Host header is not given

'virtual host object' - has a property root giving the directory to serve web requests from

This serves up all the files in /var/www listening to HTTP requests on port 8080. E.g. an HTTP request for /styles/site.css will will look for the file /var/www/styles/site.css

Features

  • HTTP Content-Type header detection from file extension
  • HTTP Content-Length header support
  • HTTP Date header
  • HTTP Last-Modified header
  • Reads files in binary mode - so can serve images and other binary files (not just text)
  • Requests to any directory try to return directory/index.html
  • Virtual Hosts

Test Suite

To run the tests:

$ node runtests.js

Credits

Original code forked from Noah Sloan's simple logging webserver.

More Repositories

1

ansible-trace

Visualise Ansible execution time across playbooks, tasks, and hosts.
Python
97
star
2

hledger-vscode

VSCode plugin for HLedger accounting journal file
TypeScript
39
star
3

profilerpedia

Catalog of profilers, profile data formats, data format converters, and profile analysis UIs.
Jupyter Notebook
32
star
4

scatter.fm

Visualise ALL of your last.fm listening history.
JavaScript
31
star
5

rtl_433_prometheus

Prometheus time-series DB exporter for rtl_433 433MHz radio packet decoder
Go
19
star
6

nzwirelessmap

A visualisation of point-to-point wireless links in New Zealand.
TypeScript
16
star
7

breathe

A Prometheus exporter for PMS5003 Particulate Matter/Air Quality sensors.
Go
11
star
8

stolen-vehicles-pt2

A visualization of NZ's stolen vehicles, using d3.js, coffeescript, and backbone.
JavaScript
9
star
9

jekyll-blog

I'm keeping my blog posts in version control!
CSS
5
star
10

cygwin-java-wrappers

Wrappers for windows java utilities to convert windows paths
Ruby
3
star
11

kaiterra_laser_egg_exporter

Prometheus.io exporter for Kaiterra Laser Egg Particulate Matter/Air Quality sensors
Go
3
star
12

mac-ansible

Provisioning my Mac automatically, keeping software up to date.
2
star
13

vimfiles

All my vim config files and plugins.
Vim Script
2
star
14

fishfiles

My fish config files
Shell
2
star
15

nzgovernmentspending

JavaScript
2
star
16

bpmtapper.com

Tap out a song, and get the number of beats per minute on it
2
star
17

suntimes

A port of some old BASIC code to javascript, just for fun
JavaScript
2
star
18

graphviz-docs

Mirror of https://gitlab.com/graphviz/graphviz.gitlab.io/
HTML
2
star
19

webgl-scattergraph

A scattergraph library using WebGL
JavaScript
2
star
20

lastfm_scraper

A quick hack to download all my scrobbles from Last.FM
Python
2
star
21

xmonad

My .xmonad dir
Haskell
2
star
22

nsw-rental-bonds

Converting monthly Excel Spreadsheet NSW Rental bond lodgment data into single data file (for export to BigQuery)
Jupyter Notebook
2
star
23

ipod-numeric-keypad

A touchscreen numeric keypad for touchscreen devices. Run the server on your computer, and browse to the server on your touchscreen device's browser. Button presses are relayed to the active window via X11 events
Ruby
2
star
24

node-daytime

A DAYTIME server
JavaScript
1
star
25

flight_scraper

flightstats.com has a really bad mobile interface, so i scraped their desktop interface to send to my phone
Ruby
1
star
26

sense_hat_exporter

A prometheus exporter for sensors from a Raspberry Pi Sense Hat.
Python
1
star
27

lastfm_visualise

Scripts to visualise my scrobbling history
Python
1
star
28

breakout

The first game I wrote that I still have the code for. Featuring some atrocious coding. Recorded here for posterity :)
C#
1
star
29

stolen-cars

A visualisation of NZ's stolen car database
JavaScript
1
star
30

lastfm_wordle

A site that glues together the Last.FM api with the Wordle API, to visualise your favorite artists
CoffeeScript
1
star
31

mhansen

1
star
32

graphviz

Mirror of https://gitlab.com/graphviz/graphviz
C
1
star
33

csv2pprof

Go
1
star
34

domain-exporter

Go
1
star
35

domain-query

Bigquery exporter for domain.com.au
Go
1
star
36

visualize_my_history

Chrome Extension to Visualize Chrome Web History on a scatterplot of Date vs Time-of-Day.
JavaScript
1
star
37

playing-with-simplecv

1
star
38

nzwirelessmap-fetch

Automated extract-transfer-load job for moving data from Radio Spectrum NZ's Access 2000 Database to a JSON file on Google Cloud Storage
Go
1
star