Skip to content

Latest commit

 

History

History
25 lines (22 loc) · 417 Bytes

File metadata and controls

25 lines (22 loc) · 417 Bytes

stnl validators for @mapl/web.

import * as bodyParser from '@mapl/stnl/body-parser';
import { t } from 'stnl';

import { router, handle } from '@mapl/web';

const app = router([
  bodyParser.json(
    'body',
    t.dict({
      name: t.string,
      pwd: t.string
    })
  )
], [
  handle.get('/info', (c) => {
    const user = c.body;
    // Use props
    console.log(c.name, c.pwd);

    ...
  })
]);