🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@olptools/http-server

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

@olptools/http-server

Unete is a microservice framework that exposes an HTTP & Socket.IO server based on native JS functions. Socket.IO server can be used to return observables that can be read in the @unete/io client.

npmnpm
Version
1.0.0
Version published
Weekly downloads
7
75%
Maintainers
1
Weekly downloads
 
Created
Source

@mysticaldragon/unete

Unete is a microservice framework that exposes an HTTP & Socket.IO server based on native JS functions. Socket.IO server can be used to return observables that can be read in the @unete/io client.

Options

{
    port: any;
    endpoints: any;
    responseType?: "object" | "raw"; // Default: "object", if = "raw", results won't be parsed as JSON

    ssl?: { // If != undefined, will expose the server as https:// & wss://
        key: string;
        cert: string;
        ca: string;
    }
}

Usage Example

import { Server } from "@mysticaldragon/unete";

new Server({
    port: 8080,
    endpoints: {
        helloWorld () {
            return "Hello World!";
        }
    }
}).listen();

Then enter http://localhost:8080/helloWorld

Response

If Options.responseType == "object"

If the function success, it will return 200 - { result } If the function throws an exception, it will return 500 - { error }

If Options.responseType == "raw"

If the function success, it will return 200 - result If the function throws an exception, it will return 500 - error

FAQs

Package last updated on 10 Oct 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