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

awebserver

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awebserver

this is a simple library to create a web server

  • 1.0.2
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-42.86%
Maintainers
1
Weekly downloads
 
Created
Source

A WEB SERVER

A simple javascript based web server.

A hello world example

This is a simple example that demonstrates dynamic url path parameters (People like that stuff)

const server = require('awebserver');

server.addRoute('/hello/{name}', 'GET', (req, res) => {
   const name = req.query.name;
   console.log(`${name} says hello`);
   res.response(200, `hello ${name}\n`);
});

server.serve(8080);

Commands

This library exposes three basic functions.

addRoute
server.addRoute({PATH}, {METHOD}, {HANDLER FUNCTION});
addErrorHandler
server.addErrorHandler({CODE}, {HANDLER FUNCTION});
serve
server.serve({PORT}, {HTTPS OPTIONS});

FAQs

Package last updated on 26 May 2020

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