šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

@kravc/http

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

@kravc/http

Minimal node.js HTTP server for web development

0.4.2
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
Ā 
Created
Source

@kravc/http

Minimal node.js HTTP server for web development.

API

Install:

npm i --save-dev @kravc/http

Get started

const { createServer } = require('@kravc/http')

await createServer(() => ({
  body:       JSON.stringify({ message: 'Hello, world!' }, null, 2),
  statusCode: 200
}))

Integration

In case you have module that exports request handler method, e.g ./index.js, add start script to package.json:

"scripts": {
  "start": "http"
}

Specify custom module name or port to start server on with options:

"scripts": {
  "start": "http ./module.js 4000"
}

Example of the npm start script with nodemon support:

"scripts": {
  "start": "NODE_PATH=./ nodemon -e js,yaml -w ./src --exec http"
}

FAQs

Package last updated on 06 Jan 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