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

rjweb-server

Package Overview
Dependencies
Maintainers
1
Versions
375
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rjweb-server - npm Package Compare versions

Comparing version 1.1.5 to 1.1.6

1

interfaces.ts
export { default as ctr } from "./src/interfaces/ctr"
export { ctrError } from "./src/interfaces/ctr"
export { default as page } from "./src/interfaces/page"
export { default as types } from "./src/interfaces/types"
export { default as ratelimitRule } from "./src/interfaces/ratelimitRule"

6

lib/classes/routeList.d.ts

@@ -1,4 +0,4 @@

import typesInterface from "../interfaces/types";
import page from "../interfaces/page";
import ctr from "../interfaces/ctr";
import { types as typesInterface } from "@/interfaces/types";
import page from "@/interfaces/page";
import ctr from "@/interfaces/ctr";
interface staticOptions {

@@ -5,0 +5,0 @@ /**

@@ -29,4 +29,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const getAllFiles_1 = require("../misc/getAllFiles");
const types_1 = __importDefault(require("../misc/types"));
const getAllFiles_1 = require("@/misc/getAllFiles");
const types_1 = __importDefault(require("@/misc/types"));
const path = __importStar(require("path"));

@@ -33,0 +33,0 @@ const fs = __importStar(require("fs"));

@@ -1,10 +0,10 @@

import ctr from "./interfaces/ctr";
import routeList from "./classes/routeList";
import rateLimitRule from "./interfaces/ratelimitRule";
import typesInterface from "./interfaces/types";
import page from "./interfaces/page";
import ctr, { ctrError } from "@/interfaces/ctr";
import routeList from "@/classes/routeList";
import rateLimitRule from "@/interfaces/ratelimitRule";
import typesEnum from "@/interfaces/types";
import page from "@/interfaces/page";
interface startOptions {
pages?: {
/** When a Route is not found */ notFound?: (ctr: ctr) => Promise<void>;
/** When an Error occurs in a Route */ reqError?: (ctr: ctr) => Promise<void>;
/** When an Error occurs in a Route */ reqError?: (ctr: ctrError) => Promise<void>;
};

@@ -58,3 +58,3 @@ events?: {

routeList: typeof routeList;
types: typeof typesInterface;
types: typeof typesEnum;
start(options: startOptions): Promise<{

@@ -61,0 +61,0 @@ success: boolean;

@@ -28,5 +28,6 @@ "use strict";

};
const routeList_1 = __importDefault(require("./classes/routeList"));
const types_1 = __importDefault(require("./interfaces/types"));
const types_2 = __importDefault(require("./misc/types"));
require('module-alias').addAlias("@", __dirname + "/");
const routeList_1 = __importDefault(require("@/classes/routeList"));
const types_1 = __importDefault(require("@/interfaces/types"));
const types_2 = __importDefault(require("@/misc/types"));
const path = __importStar(require("path"));

@@ -33,0 +34,0 @@ const http = __importStar(require("http"));

@@ -5,2 +5,3 @@ /// <reference types="node" />

import { UrlWithStringQuery } from "url";
import { types } from "@/interfaces/types";
export default interface ctr {

@@ -15,7 +16,6 @@ /** A Map of all Headers */ header: Map<any, any>;

/** The Requested URL */ reqUrl: UrlWithStringQuery & {
method: string;
method: types;
};
/** The Raw HTTP Server Req Variable */ rawReq: IncomingMessage;
/** The Raw HTTP Server Res Variable */ rawRes: ServerResponse;
/** The Error (If in the error event) */ error?: Error;
/** Set an HTTP Header to add */ setHeader: (name: string, value: string) => ctr;

@@ -26,2 +26,5 @@ /** Print a Message to the Client */ print: (msg: any) => ctr;

}
export interface ctrError extends ctr {
/** The Error */ error: Error;
}
//# sourceMappingURL=ctr.d.ts.map

@@ -1,7 +0,7 @@

import typesInterface from "../interfaces/types";
import ctr from "./ctr";
import { types } from "@/interfaces/types";
import ctr from "@/interfaces/ctr";
export default interface page {
/** An Array of the URL split by slashes */ array: string[];
/** The URL as normal String */ path: string;
/** The HTTP Request Type */ type: typesInterface;
/** The HTTP Request Type */ type: types;
/** If true then some Content Types will be added automatically */ addTypes: boolean;

@@ -8,0 +8,0 @@ /** The Async Code to run on a Request */ code: (ctr: ctr) => void;

@@ -1,2 +0,2 @@

declare enum types {
declare enum HTTPtypes {
/** HTTP Request Type */ options = "OPTIONS",

@@ -10,3 +10,4 @@ /** HTTP Request Type */ delete = "DELETE",

}
export default types;
export default HTTPtypes;
export type types = 'OPTIONS' | 'DELETE' | 'PATCH' | 'POST' | 'PUT' | 'GET' | 'STATIC';
//# sourceMappingURL=types.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var types;
(function (types) {
/** HTTP Request Type */ types["options"] = "OPTIONS";
/** HTTP Request Type */ types["delete"] = "DELETE";
/** HTTP Request Type */ types["patch"] = "PATCH";
/** HTTP Request Type */ types["post"] = "POST";
/** HTTP Request Type */ types["put"] = "PUT";
/** HTTP Request Type */ types["get"] = "GET";
/** Internal Request Type */ types["static"] = "STATIC";
})(types || (types = {}));
exports.default = types;
var HTTPtypes;
(function (HTTPtypes) {
/** HTTP Request Type */ HTTPtypes["options"] = "OPTIONS";
/** HTTP Request Type */ HTTPtypes["delete"] = "DELETE";
/** HTTP Request Type */ HTTPtypes["patch"] = "PATCH";
/** HTTP Request Type */ HTTPtypes["post"] = "POST";
/** HTTP Request Type */ HTTPtypes["put"] = "PUT";
/** HTTP Request Type */ HTTPtypes["get"] = "GET";
/** Internal Request Type */ HTTPtypes["static"] = "STATIC";
})(HTTPtypes || (HTTPtypes = {}));
exports.default = HTTPtypes;
//# sourceMappingURL=types.js.map
{
"name": "rjweb-server",
"version": "1.1.5",
"version": "1.1.6",
"description": "Easy and Lightweight Way to create a Web Server in Node.js",

@@ -8,8 +8,6 @@ "main": "lib/index.js",

"build": "rm -r lib && tsc --pretty false"
},
"repository": {
}, "repository": {
"type": "git",
"url": "git+https://github.com/rotvproHD/NPM_WEB-SERVER.git"
},
"keywords": [
}, "keywords": [
"webserver",

@@ -26,14 +24,13 @@ "web-server",

"web"
],
"author": "0x4096 (Robert Jansen)",
], "author": "0x4096 (Robert Jansen)",
"license": "MIT",
"bugs": {
"url": "https://github.com/rotvproHD/NPM_WEB-SERVER/issues"
},
"homepage": "https://github.com/rotvproHD/NPM_WEB-SERVER#readme",
}, "homepage": "https://github.com/rotvproHD/NPM_WEB-SERVER#readme",
"dependencies": {
"@types/node": "^18.11.18"
"module-alias": "^2.2.2"
}, "devDependencies": {
"@types/node": "^18.11.18",
"typescript": "^4.9.4"
}
}

@@ -1,6 +0,6 @@

import { getAllFiles, getAllFilesFilter } from "../misc/getAllFiles"
import typesInterface from "../interfaces/types"
import page from "../interfaces/page"
import ctr from "../interfaces/ctr"
import types from "../misc/types"
import { getAllFiles, getAllFilesFilter } from "@/misc/getAllFiles"
import { types as typesInterface } from "@/interfaces/types"
import page from "@/interfaces/page"
import ctr from "@/interfaces/ctr"
import types from "@/misc/types"

@@ -7,0 +7,0 @@ import * as path from "path"

@@ -1,8 +0,10 @@

import ctr from "./interfaces/ctr"
import routeList from "./classes/routeList"
import rateLimitRule from "./interfaces/ratelimitRule"
import typesInterface from "./interfaces/types"
import page from "./interfaces/page"
import types from "./misc/types"
require('module-alias').addAlias("@", __dirname + "/");
import ctr, { ctrError } from "@/interfaces/ctr"
import routeList from "@/classes/routeList"
import rateLimitRule from "@/interfaces/ratelimitRule"
import typesEnum from "@/interfaces/types"
import page from "@/interfaces/page"
import types from "@/misc/types"
import * as path from "path"

@@ -16,3 +18,3 @@ import * as http from "http"

/** When a Route is not found */ notFound?: (ctr: ctr) => Promise<void>
/** When an Error occurs in a Route */ reqError?: (ctr: ctr) => Promise<void>
/** When an Error occurs in a Route */ reqError?: (ctr: ctrError) => Promise<void>
}, events?: {

@@ -66,3 +68,3 @@ /** On Every Request */ request?: (ctr: ctr) => Promise<void>

routeList,
types: typesInterface,
types: typesEnum,

@@ -99,3 +101,3 @@ // Start

}).on('end', async () => {
let reqUrl = { ...url.parse(req.url), method: req.method }
let reqUrl = { ...url.parse(req.url), method: req.method as any }
if (reqUrl.path.endsWith('/')) reqUrl.path = reqUrl.path.slice(0, -1)

@@ -239,4 +241,4 @@ let executeUrl = ''

if ('reqError' in pages) {
ctr.error = e
Promise.resolve(options.pages.reqError(ctr)).catch((e) => {
(ctr as ctrError).error = e
Promise.resolve(options.pages.reqError(ctr as ctrError)).catch((e) => {
console.log(e)

@@ -271,4 +273,4 @@ res.statusCode = 500

if ('reqError' in pages) {
ctr.error = e
Promise.resolve(options.pages.reqError(ctr)).catch((e) => {
(ctr as ctrError).error = e
Promise.resolve(options.pages.reqError(ctr as ctrError)).catch((e) => {
console.log(e)

@@ -313,4 +315,4 @@ res.statusCode = 500

if ('reqError' in pages) {
ctr.error = e
Promise.resolve(options.pages.reqError(ctr)).catch((e) => {
(ctr as any).error = e
Promise.resolve(options.pages.reqError(ctr as ctrError)).catch((e) => {
console.log(e)

@@ -360,4 +362,4 @@ res.statusCode = 500

if ('reqError' in pages) {
ctr.error = e
options.pages.reqError(ctr).catch((e) => {
(ctr as ctrError).error = e
options.pages.reqError(ctr as ctrError).catch((e) => {
console.log(e)

@@ -364,0 +366,0 @@ res.statusCode = 500

import { IncomingMessage, ServerResponse } from "http"
import { UrlWithStringQuery } from "url"
import { types } from "@/interfaces/types"

@@ -13,3 +14,3 @@ export default interface ctr {

/** The Request Body (JSON Automatically parsed) */ reqBody: any
/** The Requested URL */ reqUrl: UrlWithStringQuery & { method: string }
/** The Requested URL */ reqUrl: UrlWithStringQuery & { method: types }

@@ -19,4 +20,2 @@ /** The Raw HTTP Server Req Variable */ rawReq: IncomingMessage

/** The Error (If in the error event) */ error?: Error
/** Set an HTTP Header to add */ setHeader: (name: string, value: string) => ctr

@@ -26,2 +25,6 @@ /** Print a Message to the Client */ print: (msg: any) => ctr

/** Print the Content of a File to the Client */ printFile: (path: string) => ctr
}
export interface ctrError extends ctr {
/** The Error */ error: Error
}

@@ -1,3 +0,3 @@

import typesInterface from "../interfaces/types"
import ctr from "./ctr"
import { types } from "@/interfaces/types"
import ctr from "@/interfaces/ctr"

@@ -7,3 +7,3 @@ export default interface page {

/** The URL as normal String */ path: string
/** The HTTP Request Type */ type: typesInterface
/** The HTTP Request Type */ type: types
/** If true then some Content Types will be added automatically */ addTypes: boolean

@@ -10,0 +10,0 @@ /** The Async Code to run on a Request */ code: (ctr: ctr) => void

@@ -1,2 +0,2 @@

enum types {
enum HTTPtypes {
/** HTTP Request Type */ options = 'OPTIONS',

@@ -11,2 +11,11 @@ /** HTTP Request Type */ delete = 'DELETE',

export default types
export default HTTPtypes
export type types =
'OPTIONS' |
'DELETE' |
'PATCH' |
'POST' |
'PUT' |
'GET' |
'STATIC'

@@ -12,6 +12,9 @@ {

"outDir": "lib",
"downlevelIteration": true,
"baseUrl": "src",
"downlevelIteration": true
"paths": {
"@/*": ["./*"]
}
},
"include": ["src/**/*"]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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