npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jetpress

v1.1.28

Published

JetPress is a high-performance, flexible, and extensible web server framework designed to streamline web development.JetPress aims to provide developers with an efficient and versatile platform for building web applications and APIs.JetPress is a high-per

Downloads

9

Readme

JetPress

JetPress is a high-performance, flexible, and extensible web server framework designed to streamline web development.JetPress aims to provide developers with an efficient and versatile platform for building web applications and APIs.JetPress is a high-performance Node.js framework for building fast and scalable server applications using TypeScript. It also supports Bun for an even faster runtime experience.

npm i jetpress@latest

Key Features

  1. High Performance: Built with performance in mind, JetPress ensures rapid request handling and efficient resource management.
  2. Flexible Routing: Supports both static and dynamic routing, allowing developers to easily define routes and handle requests.
  3. Static File Serving: Effortlessly serve static files from specified directories, making it ideal for serving HTML, CSS, JavaScript, images, and other assets.
  4. Middleware Support: Integrate custom middleware to handle request preprocessing, logging, authentication, and other tasks.
  5. Built-in Body Parser: Automatically parses incoming request bodies, supporting JSON, URL-encoded, and multipart form data. This includes built-in support for handling file uploads.
  6. File Uploader: Seamlessly handle file uploads, with easy access to uploaded files through the request object.
  7. Cookie Parser: Built-in support for parsing cookies, allowing for easy manipulation and management of cookies within your application.
  8. URL Parser: Comprehensive URL parsing capabilities, extracting query parameters, path variables, and other URL components.
  9. Modular Design: Promotes a modular approach, enabling developers to organize their codebase efficiently.
  10. TypeScript Support: Written in TypeScript, providing strong type definitions and interfaces, enhancing development experience and reducing runtime errors.
  11. Extensible: Easily extend JetPress with additional features and plugins as needed.

Full documentation

Example Use Case

import { readFile, writeFile } from "fs";
import { Request, Response,FormWizard, Router, Server } from "jetpress";
import path from "path";

const server = new Server();

// Middleware for parsing form data
server.use(FormWizard);

// Static file serving
server.static('/static', path.join(__dirname, 'public'), {
    cacheControl: 'public, max-age=31536000', // 1 year
    headers: {
        'Content-Security-Policy': "default-src 'self'",
        'X-Content-Type-Options': 'nosniff',
        'X-Frame-Options': 'DENY',
        'X-XSS-Protection': '1; mode=block'
    }
});
server.static('/uploads', './uploads');
// Serve static folder with cache control and custom headers
server.static('/static', path.join(__dirname, 'public'), {
    cacheControl: 'public, max-age=31536000', // 1 year
    headers: {
        'Content-Security-Policy': "default-src 'self'",
        'X-Content-Type-Options': 'nosniff',
        'X-Frame-Options': 'DENY',
        'X-XSS-Protection': '1; mode=block'
    }
});

// Define routes
server.get('/', (req: Request, res: Response) => {
    res.html('<h1>Welcome to JetPress!</h1>');
});

server.post('/upload', (req: Request, res: Response) => {
    const uploadedFile = req.file;
    if (!uploadedFile) {
        return res.status(400).send('No file uploaded.');
    }

    const newPath = path.join(__dirname, 'uploads', uploadedFile.filename);
    writeFile(newPath, uploadedFile.buffer, err => {
        if (err) throw err;
        console.log('File saved successfully:', newPath);
        res.send('File uploaded and processed successfully.');
    });
});

// Example route using router
const router = new Router();
router.get("/example", (req: Request, res: Response) => {
    res.json({ message: "Hello from the router!" });
});
server.use('/api', router);

// Handle all other routes with a 404
server.use("*", (req: Request, res: Response) => {
    res.html("Not Found");
});

// Start the server
server.listen(3000, () => {
    console.log('JetPress server running at http://localhost:3000');
});

With JetPress, you can build modern web applications quickly and efficiently, leveraging its high performance, flexible routing, and comprehensive feature set. Whether you're building a simple website or a complex API, JetPress has the tools you need to succeed.

Contributing

If you want to encourage contributions, include guidelines for contributing to the project. This may include information on how to report issues or submit pull requests.