Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
A web server framework for Node.js.
npm install webu.js
const fs = require('fs');
const path = require('path');
const Webu = require('webu.js');
const webu = new Webu();
// Handling GET requests
webu.get('/', (req, res) => {
res.send(200, '<h1>Hello, World!</h1>', { 'Content-Type': 'text/html' });
});
// Handling PUT requests
webu.put('/update', (req, res) => {
res.send(200, 'Resource updated successfully!');
});
// Handling files
webu.get('/file', (req, res) => {
// Specify the path to your HTML file
const htmlFilePath = path.join(__dirname, 'index.html');
// Read the HTML file
fs.readFile(htmlFilePath, 'utf8', (err, data) => {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(data);
});
});
// Setting a custom error page for 404 errors
webu.error((req, res) => {
res.send(404, '<h1>Custom 404 Error Page</h1>', { 'Content-Type': 'text/html' });
});
// Starting the server on port 3000
webu.start(3000, (port) => {
console.log(`Server listening on: ${port}`);
});
Webu.js allows you to handle various HTTP methods such as GET, PUT, POST, DELETE, PATCH, HEAD, OPTIONS, and TRACE.
webu.get('/', (req, res) => {
// Handle GET request for '/'
});
webu.put('/update', (req, res) => {
// Handle PUT request for '/update'
});
// Similarly, you can use post, delete, patch, head, options, and trace methods
Set custom error pages to handle specific HTTP status codes. In this example, a custom 404 error page is set.
webu.error((req, res) => {
res.send(404, '<h1>Custom 404 Error Page</h1>', { 'Content-Type': 'text/html' });
});
Feel free to contribute by opening issues or submitting pull requests. See CONTRIBUTING.md for more information.
This project is licensed under the ISC License - see the LICENSE file for details.
FAQs
A lightweight and flexible web server framework for Node.js.
The npm package webu.js receives a total of 0 weekly downloads. As such, webu.js popularity was classified as not popular.
We found that webu.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.