Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Latest commit

 

History

History

router

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

router

Grapnel, the smallest Javascript router with named parameters.

Usage

Component

import jails from 'jails'
import Router from 'jails.packages/router'

jails('my-component', ( {init:main} ) => {

    const router = new Router()

    main(()=>[
        routes
    ])

    const routes = () => {
        // http://localhost:3000/#/home
        // http://localhost:3000/#/about
        router.get('/', log('home'))
        router.get('/about', log('about'))
    }

    const log = (page) => () => {
        console.log(`The page is: ${page}`)
    }
})

jails.start()