Socket
Socket
Sign inDemoInstall

rjweb-server

Package Overview
Dependencies
2
Maintainers
1
Versions
369
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.2 to 1.1.3

24

lib/classes/routeList.d.ts

@@ -5,11 +5,23 @@ import typesInterface from "../interfaces/types";

interface staticOptions {
/** If true then files will be loaded into RAM */ preload?: boolean;
/** If true then .html will be removed automatically */ remHTML?: boolean;
/** If true then some Content Types will be added automatically */ addTypes?: boolean;
/**
* If true then files will be loaded into RAM
* @default false
*/ preload?: boolean;
/**
* If true then .html will be removed automatically
* @default false
*/ remHTML?: boolean;
/**
* If true then some Content Types will be added automatically
* @default true
*/ addTypes?: boolean;
}
export default class routeList {
urls: page[];
private urls;
/** List of Routes */
constructor(
/** Routes to Import */ routes?: page[]);
/**
* Routes to Import
* @default []
*/ routes?: page[]);
/** Set A Route Manually */

@@ -28,3 +40,3 @@ set(

/** The Location of the Folder to load from */ folder: string): void;
/** Internal Function */
/** Internal Function to access all URLs as Array */
list(): page[];

@@ -31,0 +43,0 @@ }

@@ -36,4 +36,7 @@ "use strict";

constructor(
/** Routes to Import */ routes) {
routes = routes || [];
/**
* Routes to Import
* @default []
*/ routes) {
routes = routes ?? [];
this.urls = routes;

@@ -61,5 +64,5 @@ }

/** Additional Options */ options) {
const preload = options?.preload || false;
const remHTML = options?.remHTML || false;
const addTypes = options?.addTypes || true;
const preload = options?.preload ?? false;
const remHTML = options?.remHTML ?? false;
const addTypes = options?.addTypes ?? true;
for (const file of (0, getAllFiles_1.getAllFiles)(folder)) {

@@ -106,3 +109,3 @@ const fileName = file.replace(folder, '');

}
/** Internal Function */
/** Internal Function to access all URLs as Array */
list() {

@@ -109,0 +112,0 @@ return this.urls;

@@ -18,5 +18,14 @@ import ctr from "./interfaces/ctr";

rateLimits?: {
/** If true Ratelimits are enabled */ enabled: boolean;
/** The Message that gets sent when a ratelimit maxes out */ message?: any;
/** The List of Ratelimit Rules */ list: rateLimitRule[];
/**
* If true Ratelimits are enabled
* @default false
*/ enabled: boolean;
/**
* The Message that gets sent when a ratelimit maxes out
* @default "Rate Limited"
*/ message?: any;
/**
* The List of Ratelimit Rules
* @default []
*/ list: rateLimitRule[];
/** The RateLimit Functions */ functions: {

@@ -27,7 +36,22 @@ set: (key: string, value: any) => Promise<any>;

};
/** Where the Server should bind to */ bind?: string;
/** If true x-forwarded-for will be shown as hostIp */ proxy?: boolean;
/** If true all cors headers are set */ cors?: boolean;
/** Where the Server should start at */ port?: number;
/** The Maximum Body Size in MB */ body?: number;
/**
* Where the Server should bind to
* @default "0.0.0.0"
*/ bind?: string;
/**
* If true X-Forwarded-For will be shown as hostIp
* @default false
*/ proxy?: boolean;
/**
* If true all cors headers are set
* @default false
*/ cors?: boolean;
/**
* Where the Server should start at
* @default 5002
*/ port?: number;
/**
* The Maximum Body Size in MB
* @default 20
*/ body?: number;
}

@@ -34,0 +58,0 @@ declare const _default: {

@@ -42,11 +42,11 @@ "use strict";

/** Required Options */ options) {
const pages = options?.pages || {};
const events = options?.events || {};
const urls = options?.urls.list() || [];
const proxy = options?.proxy || false;
const rateLimits = options?.rateLimits || { enabled: false, list: [] };
const bind = options?.bind || '0.0.0.0';
const cors = options?.cors || false;
const port = options?.port || 5002;
const body = options?.body || 20;
const pages = options?.pages ?? {};
const events = options?.events ?? {};
const urls = options?.urls.list() ?? [];
const proxy = options?.proxy ?? false;
const rateLimits = options?.rateLimits ?? { enabled: false, list: [] };
const bind = options?.bind ?? '0.0.0.0';
const cors = options?.cors ?? false;
const port = options?.port ?? 5002;
const body = options?.body ?? 20;
const server = http.createServer(async (req, res) => {

@@ -177,3 +177,4 @@ let reqBody = '';

setHeader(name, value) {
return res.setHeader(name, value);
res.setHeader(name, value);
return ctr;
}, print(msg) {

@@ -219,6 +220,11 @@ switch (typeof msg) {

}
}, status(code) { res.statusCode = code; },
printFile(file) {
;
return ctr;
}, status(code) {
res.statusCode = code;
return ctr;
}, printFile(file) {
const content = fs.readFileSync(file);
return res.write(content, 'binary');
res.write(content, 'binary');
return ctr;
}

@@ -225,0 +231,0 @@ };

{
"name": "rjweb-server",
"version": "1.1.2",
"version": "1.1.3",
"description": "Easy and Lightweight Way to create a Web Server in Node.js",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -11,15 +11,27 @@ import { getAllFiles, getAllFilesFilter } from "../misc/getAllFiles"

interface staticOptions {
/** If true then files will be loaded into RAM */ preload?: boolean
/** If true then .html will be removed automatically */ remHTML?: boolean
/** If true then some Content Types will be added automatically */ addTypes?: boolean
/**
* If true then files will be loaded into RAM
* @default false
*/ preload?: boolean
/**
* If true then .html will be removed automatically
* @default false
*/ remHTML?: boolean
/**
* If true then some Content Types will be added automatically
* @default true
*/ addTypes?: boolean
}
export default class routeList {
urls: page[]
private urls: page[]
/** List of Routes */
constructor(
/** Routes to Import */ routes?: page[]
/**
* Routes to Import
* @default []
*/ routes?: page[]
) {
routes = routes || []
routes = routes ?? []
this.urls = routes

@@ -50,5 +62,5 @@ }

) {
const preload = options?.preload || false
const remHTML = options?.remHTML || false
const addTypes = options?.addTypes || true
const preload = options?.preload ?? false
const remHTML = options?.remHTML ?? false
const addTypes = options?.addTypes ?? true

@@ -98,3 +110,3 @@ for (const file of getAllFiles(folder)) {

/** Internal Function */
/** Internal Function to access all URLs as Array */
list() {

@@ -101,0 +113,0 @@ return this.urls

@@ -22,5 +22,14 @@ import ctr from "./interfaces/ctr"

}, rateLimits?: {
/** If true Ratelimits are enabled */ enabled: boolean
/** The Message that gets sent when a ratelimit maxes out */ message?: any
/** The List of Ratelimit Rules */ list: rateLimitRule[]
/**
* If true Ratelimits are enabled
* @default false
*/ enabled: boolean
/**
* The Message that gets sent when a ratelimit maxes out
* @default "Rate Limited"
*/ message?: any
/**
* The List of Ratelimit Rules
* @default []
*/ list: rateLimitRule[]
/** The RateLimit Functions */ functions: {

@@ -32,7 +41,22 @@ set: (key: string, value: any) => Promise<any>

/** Where the Server should bind to */ bind?: string
/** If true x-forwarded-for will be shown as hostIp */ proxy?: boolean
/** If true all cors headers are set */ cors?: boolean
/** Where the Server should start at */ port?: number
/** The Maximum Body Size in MB */ body?: number
/**
* Where the Server should bind to
* @default "0.0.0.0"
*/ bind?: string
/**
* If true X-Forwarded-For will be shown as hostIp
* @default false
*/ proxy?: boolean
/**
* If true all cors headers are set
* @default false
*/ cors?: boolean
/**
* Where the Server should start at
* @default 5002
*/ port?: number
/**
* The Maximum Body Size in MB
* @default 20
*/ body?: number
}

@@ -49,13 +73,13 @@

) {
const pages = options?.pages || {}
const events = options?.events || {}
const urls = options?.urls.list() || []
const proxy = options?.proxy || false
const rateLimits = options?.rateLimits || { enabled: false, list: [] }
const bind = options?.bind || '0.0.0.0'
const cors = options?.cors || false
const port = options?.port || 5002
const body = options?.body || 20
const pages = options?.pages ?? {}
const events = options?.events ?? {}
const urls = options?.urls.list() ?? []
const proxy = options?.proxy ?? false
const rateLimits = options?.rateLimits ?? { enabled: false, list: [] }
const bind = options?.bind ?? '0.0.0.0'
const cors = options?.cors ?? false
const port = options?.port ?? 5002
const body = options?.body ?? 20
const server = http.createServer(async (req, res) => {
const server = http.createServer(async(req, res) => {
let reqBody = ''

@@ -73,3 +97,3 @@

req.on('data', (data: any) => {
req.on('data', (data: string) => {
reqBody += data

@@ -187,5 +211,6 @@ }).on('end', async () => {

// Functions
setHeader(name, value) {
return res.setHeader(name, value)
}, print(msg) {
setHeader(name: string, value: string) {
res.setHeader(name, value)
return ctr
}, print(msg: any) {
switch (typeof msg) {

@@ -231,7 +256,10 @@ case 'object':

}
}
}, status(code: number) { res.statusCode = code },
printFile(file: string) {
}; return ctr
}, status(code: number) {
res.statusCode = code
return ctr
}, printFile(file: string) {
const content = fs.readFileSync(file)
return res.write(content, 'binary')
res.write(content, 'binary')
return ctr
}

@@ -238,0 +266,0 @@ }

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc