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

@junaid1460/hapiest

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@junaid1460/hapiest

Decorators for hapi 17+

latest
Source
npmnpm
Version
1.0.13
Version published
Maintainers
1
Created
Source

[Hapiest] Beautiful code is what I seek.

NPM version


npm i @junaid1460/hapiest

Requirements

hapi 17+ typescript 3 (es6)

Usage

import { Request, ResponseToolkit, Server } from "hapi";
import { AbstractHapiModule, Decorators as d, HapiServerRoutes } from "@junaid1460/hapiest";

@d.routeGroup({ baseUrl: "api", auth: false })
export class AdminRoutes extends HapiServerRoutes {

    @d.get({path: ""}) // Path:  /api
    api(request: Request, toolkit: ResponseToolkit, err?: Error) {
        return "base\n"
    }

    @d.get() // Path: /api/getTest
    public getTest(request: Request, toolkit: ResponseToolkit, err?: Error) {
        return "hey, what's up?\n";
    }

    @d.get({path: 'name'}) // Path: /api/name
    public async getit(request: Request, toolkit: ResponseToolkit, err?: Error) {
        return "junaid\n";
    }
}


class ArenaMainModule extends AbstractHapiModule {
    public routeSets = [AdminRoutes];
    public baseUrl = "dev";
}

export const hapiServer = new Server({
    host: '0',
    port: 8000,
    routes: { cors: true },
});

async function start()  {
    await hapiServer.route(new ArenaMainModule().getRoutes())
    await hapiServer.start().then(e => {
        console.log("server started", hapiServer.table())
    })
}

start()


Keywords

hapi

FAQs

Package last updated on 21 Jun 2019

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