1.1.4 • Published 3 years ago

single-page-app-server v1.1.4

Weekly downloads
19
License
AGPL-3.0
Repository
github
Last release
3 years ago

single-page-app-server

A HTTP server for single page applications (angular, vue, react).

Features

  • no dependencies
  • very fast
  • simple to use
  • define custom HTTP response headers (solve CORS)
  • compress HTTP response (gzip or deflate)

Example

const SPAserver = require('../server');

const httpOpts = {
  port: 4520,
  timeout: 0, // if 0 never timeout
  staticDir: '/dist/angular-project',
  indexFile: 'index.html',
  acceptEncoding: 'deflate', // gzip, deflate or ''
  headers: {
    // CORS Headers
    'Access-Control-Allow-Origin': '*',
    'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept, Authorization',
    'Access-Control-Allow-Methods': 'GET', // 'Access-Control-Allow-Methods': 'GET, POST, PUT, PATCH, DELETE, HEAD',
    'Access-Control-Max-Age': '3600'
  },
  debug: false
};

const spaServer = new SPAserver(opts);
spaServer.start();

API

  • start(): httpServer - start the HTTP server
  • stop(): void - stop the HTTP server
  • restart(): void - restart the HTTP server

Licence

Copyright (c) 2020 Saša Mikodanić licensed under AGPL-3.0 .

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago