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

funckly

v2.5.31

Published

Simple Web API Framework

Downloads

11

Readme

... how to create a funckly APPLICATION ...

const server = new VanillaServer(5001)
const application = new Application(server)

... how to create a funckly CONTROLLER ...

interface MyModel {
    cat: string
    dog?: number | null
    tiger: string
}

interface MyFilter {
    lion?: boolean
    crocodile?: number
}

class MyController implements IController<MyModel, MyFilter> {

    public async create(input: ICreateInput<MyModel>): Promise<MyModel> { 
        // my code
    }

    public async read(input: IReadInput): Promise<MyModel> { 
        // my code
    }

    public async update(input: IUpdateInput<MyModel>): Promise<MyModel> { 
        // my code
    }

    public async delete(input: IDeleteInput): Promise<void> { 
        // my code
    }

    public async list(input: IListInput<MyFilter>): Promise<IPage<MyModel>> { 
        // my code    
    }
    
}

... how to create a funckly REST UNIT ...

application.createRestUnit<MyModel, MyFilter>('horses')
    .setController(() => new MyController())
    .setPrevalidation(PrevalidationFormat.Ncode)
    .setValidation(model =>
        new Validator(model)
            .notEmpty(model => model.cat, 'empty cat')
            .isString(model => model.cat, 'cat is not string')
            .isFloat(model => model.dog, 'dog is not float')
            .notEmpty(model => model.tiger, 'empty tiger')
            .isUuid(model => model.tiger, 'tiger is not UUID')
    )
    .setNormalization(normalizer =>
        normalizer
            .asBoolean('lion')
            .asInt('crocodile')
    )

... how to create a funckly RPC UNIT ...

interface MyData {
    cat: string
    dog?: number | null
    tiger: string
}

interface MyResult {
    lion?: boolean
    crocodile?: number
}

class MyResolver implements IResolver<MyData, MyResult> {

    public async execute(input: IExecuteInput<MyData>): Promise<MyResult> {
        // my code
    }
    
}

application.createRpcUnit<MyData, MyResult>('snake')
    .setResolver(() => new MyResolver())
    .setValidation(data =>
        new Validator(data)
            .notEmpty(data => data.cat, 'empty cat')
            .isString(data => data.cat, 'cat is not string')
            .isFloat(data => data.dog, 'dog is not float')
            .notEmpty(data => data.tiger, 'empty tiger')
            .isUuid(data => data.tiger, 'tiger is not UUID')
    )

... available http calls ...

HTTP POST   /horses           (create)
HTTP GET    /horses/12345     (read)
HTTP PUT    /horses/12345     (update)
HTTP PATCH  /horses/12345     (read & update)
HTTP DELETE /horses/12345     (delete)
HTTP GET    /horses?lion=true (list)

HTTP POST   /snake            (execute)

... how to create a funckly GRAPHQL UNIT ...

const myRunner: IRunQuery = async (
    query: string, 
    schema: string, 
    runnable: object
): Promise<IGraphResult> => {
    // my code
}

application.createGraphUnit('frog')
    .setRunner(myRunner)
    .setSchema(`
        type Query {
            hello: String
        }
    `)
    .setRunnable(() => {
        return {
            hello() {
                return 'Hello World'
            }
        }
    })