🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@anodized/http

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anodized/http

A decorator driven IoC backend framework aimed at keeping your codebase clean and reducing complexity

1.0.16
latest
Source
npm
Version published
Weekly downloads
9
12.5%
Maintainers
1
Weekly downloads
 
Created
Source

Anodized HTTP components

The HTTP components to the Anodized framework, built for complete modularity.

Installation

First, install the HTTP components

npm i @anodized/http

Next, create your entry script, in this example we'll say src/app.ts

import { AnodizedApp } from '@anodized/http';

AnodizedApp({
    httpPort: 8080,
    sourceDirectory: 'src/',
    runtimeType: 'node', // this is future-proofing for use in serverless environments such as AWS lambda.
    // optional extras,
    logger: {
        log: (value: string) => {},
        warn: (value: string) => {}
        error: (value: string) => {}
        exception: (value: string) => {}
    },
    plugins: [
        // lookup @anodized/tsx
    ],
    publicDirectories: [
        'public/'
    ],
    verbose: false, // defaults to false.
})

Now all your TypeScript components will be loaded fron the source directory. Next, create a controller, in lets say src/controllers/homepage.ts

import { Get, Controller, PreAuthorize } from '@anodized/http'

@Controller()
class Homepage
{
    @Get({ path: '/', produces: 'text/html' })
    showHomepage() {
        return '<h1>Hello World</h1>';
    }
    @Get({ path: '/about.html' })
    showAbout() {
        return '<h1>About me</h1>';
    }
}

Now, run your application and head to http://localhost:8080 to see your result. See the wiki for more in-depth examples.

Keywords

Anodized

FAQs

Package last updated on 06 Apr 2024

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