1.0.5 • Published 10 months ago

@waveorb/server v1.0.5

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

Waveorb Server

Extraordinary Javascript Web Server.

Adds what's missing from the built in web server of NodeJS:

  • Body parameters and file uploads
  • Cookies
  • Cors
  • Plugins
  • Middleware
  • Language
  • Redirects
  • Mime types
  • Request store
  • Routes
  • Static files
  • Extra properties:
    • IP address
    • pathname
    • protocol
  • And more!

The server is extremely fast and minimal.

Install

npm i @waveorb/server

Usage

Minimal usage example with callback function:

var server = require('@waveorb/server')

server({ port: 9000 }, async function (req, res) {
  if (req.pathname == '/hello') {
    return { hello: 'world' }
  }
})

More advanced example with pages and assets:

var server = require('@waveorb/server')

var routes = [
  {
    path: '/',
    to: 'pages/home.js',
  },
  {
    path: '/about',
    to: 'app/pages/about.js'
  }
]

server({ routes, port: 9095, assets: 'app/assets' })

Created by Eldøy Projects