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

@minimajs/server

v0.1.4

Published

Introducing the groundbreaking HTTP framework for Node.js - an innovation tailored for the modern developer seeking efficiency, elegance, and speed. This framework is designed with a forward-looking mindset, embracing the latest advancements in JavaScript

Downloads

24

Readme

Introducing the groundbreaking HTTP framework for Node.js - an innovation tailored for the modern developer seeking efficiency, elegance, and speed. This framework is designed with a forward-looking mindset, embracing the latest advancements in JavaScript while prioritizing ease of use and performance.

Highlights

  • Functional Approach: Embracing the functional programming paradigm, this framework empowers developers to write clean, concise, and composable code, promoting modular design and scalability.

  • 100% TypeScript: Built entirely in TypeScript, ensures type safety throughout the development process, reducing errors and enhancing code quality.

  • Mandatory ESM Adoption: mandates the adoption of ECMAScript Modules (ESM) over CommonJS, ensuring developers unlock the full potential of modern JavaScript features like root-level await, code splitting and more...

  • Instant Context Access: seamless access to request data like headers or body with functions like getRequest() and getBody() anywhere within the same request context. Say goodbye to tedious req/res drilling.

  • No Boilerplate Needed: Bid farewell to boilerplate code. With its minimalist approach, eliminates unnecessary setup and configuration.

Getting started

Your project directory structure should look like this:

.
├── src
│   ├── index.ts         // Entry point
│   └── user             // User module
│       └── index.ts     // User module entry point
└── package.json

Ensure that your package.json file has the "type": "module" field to enable ECMAScript modules (ESM) support:

{
  "name": "hello-nodejs",
  "type": "module"
}

Creating Your Application

import { createApp, getParam } from "@minimajs/server";

const app = createApp();

app.get("/:name", () => `Hello ${getParam("name")}!`);

await app.listen({ port: 1234 });

This code creates a MinimaJS application with a single route handler for the root URL ("/") and a parameter name.

That's all!


Compiling and running your TypeScript project:

Using tsc Compiler

While you can compile your TypeScript code using the TypeScript Compiler (tsc) and then run the compiled JavaScript files, it might involve multiple steps. Here's how you can do it:

tsc src/*.ts --module NodeNext --moduleResolution NodeNext --outDir dist
node dist/index.js

Server listening at http://0.0.0.0:1234

curl http://0.0.0.0:1234/John
> Hello John!

Using ebx Bundler

On the other hand, you can utilize the ebx bundler, known for its lightning-fast performance and seamless bundling experience tailored specifically for Node.js projects. Read more https://npmjs.com/package/ebx

installing ebx

yarn add -D ebx

Add following inside your package.json file

{
  "scripts": {
    "dev": "ebx src/index.ts -wsr",
    "build": "ebx src/index.ts",
    "start": "node dist/index.js"
  }
}

With ebx, you can directly bundle and execute your TypeScript code in a single step, significantly reducing build times and simplifying your workflow.

To start your project in development mode.

yarn dev

To build your project for production deployment, run:

yarn build

Once your project is built, you can start the server using:

yarn start

This command runs the compiled JavaScript files in the dist directory.

See the full documentation https://minima-js.github.io/