Routing is the most important thing, check this out


In the versatile world of JavaScript, wrap plays a key role in harmonizing the language’s polymorphic nature with Vixeny’s functional approach. It ensures scalability and maintains code purity, crucial for efficient web development.

// name of this file: api.ts
import { wrap } from "vixeny";
//routing options
import { options } from "somewhere.ts"; 

const api = wrap({
  //setting up options
  startWith: "/api",
//creating a petition
    path: "/ping",
    f: () => "pong",

export { api }

Simplifing handling diverse HTTP requests, offering a structured, side-effect-free programming environment. This makes building, maintaining, and scaling web applications more intuitive and manageable, showcasing wrap as an essential tool in the Vixeny toolkit.

import { wrap, vixeny } from "vixeny";
import { options } from "somewhere.ts"; 
import { api } from "api.ts"; 

const router = wrap(options)()
    path: "/",
    f: () => "hello world",
  //joining `api` to this wrap
  // console logging:
  // outputs: '/'
  //          '/api/ping'

// unwrapping all the petitions giving them to the router


Let’s create a Petition without wrap and export it an create new differents routes out of it.

import { Petition } from "vixeny/optimizer/types";

const surprise: Petition = {
    path: "/meow",
    headings: {
        status: 307,
        statusText: "Temporary Redirect",
        headers: {
            Location: ""
    f: (c) => ""

export { surprise }

In another file:

import { surprise }  from 'somewhere.ts'

export default wrap(options)()
  .stdPetition({...surprise, path: '/woof'})
  .stdPetition({...surprise, path: '/woooow'})
  // console logging:
  // outputs: '/meow'
  //          '/woof'
  //          '/woooow'

Applies to any other key in the object.


There are two type of petitions:

  • stdPetition: where you have to return a BodyInt or Promise<BodyInt>
  • customPetition: where you have to return a Response or Promise<Response>
    path: "/",
    f: () => "hello world",
    path: "/response/who/:name",
    f: (c) =>  new Response(

It is important to note that wrap only supports these types although there are more types which serve different purposes which must be directly inserted.

    //importing all the paths
    //adding the static server
      type: "fileServer",
      path: "./public/",
      name: "/public/",
    // petition without ctx
      path: "/responseType",
      type: "response",
      r: () => new Response('Hello')