New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@nl-framework/http

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nl-framework/http

HTTP server adapter for nl-framework built on Bun, with routing, middleware, and controller integration.

latest
npmnpm
Version
0.3.5
Version published
Maintainers
1
Created
Source

@nl-framework/http

HTTP routing primitives for the Nael Framework featuring controllers, route decorators, middleware, and guard integration.

Installation

bun add @nl-framework/http

Import reflect-metadata in your entry point if you haven’t already:

import 'reflect-metadata';

Highlights

  • Annotation-based routing – declare controllers, routes, and guards using decorators like @Controller, @Get, and @UseGuards.
  • Request context – access params, query, headers, and user state through typed handler signatures.
  • Automatic DTO validation – request bodies annotated with class-validator rules are transformed with class-transformer, stripped of unknown properties, and rejected with a structured 400 response when invalid.
  • Auth-friendly – pair with @nl-framework/auth to secure routes using session guards or middleware.

Quick start

import { Controller, Get, Post, Body, Param } from '@nl-framework/http';
import { Module } from '@nl-framework/core';
import { bootstrapHttpApplication } from '@nl-framework/platform';
import { IsEmail, IsOptional, IsString } from 'class-validator';

class CreateUserDto {
  @IsEmail()
  email!: string;

  @IsOptional()
  @IsString()
  name?: string;
}

@Controller('/users')
class UsersController {
  private readonly users = new Map<string, { id: string; email: string; name?: string }>();

  @Get('/')
  list() {
    return Array.from(this.users.values());
  }

  @Get('/:id')
  findOne(@Param('id') id: string) {
    return this.users.get(id);
  }

  @Post('/')
  create(@Body() body: CreateUserDto) {
    const id = crypto.randomUUID();
    const user = { id, email: body.email, name: body.name };
    this.users.set(id, user);
    return user;
  }
}

@Module({ controllers: [UsersController] })
class AppModule {}

const app = await bootstrapHttpApplication(AppModule, { port: 3000 });
await app.start();
console.log('HTTP server ready on http://localhost:3000');

License

Apache-2.0

Keywords

bun

FAQs

Package last updated on 06 Dec 2025

Did you know?

Socket

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.

Install

Related posts