@hoth/molecule
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

@hoth/molecule

Demo

controller.ts

import {FastifyLoggerInstance} from 'fastify';
import {Controller as IController} from '@baidu/molecule';

export class Controller implements IController {
    root: string;
    logger: FastifyLoggerInstance;

    constructor(options: Option) {
        this.logger = options.logger;
        this.root = options.root;
    }

    render(data: Data) {
        return `appname is ${data.appname}, route name is ${data.name}, title is ${data.title}`;
    }
}

node server

import {molecule} from '@hoth/molecule';

let ret = await molecule(ctrlPath, data, {
    root: '/dist',
    appName: 'appname',
    name: 'route name',
    logger: fastify.log,
});

Readme

Keywords

Package Sidebar

Install

npm i @hoth/molecule

Weekly Downloads

4

Version

1.1.5

License

MIT

Unpacked Size

6.45 kB

Total Files

8

Last publish

Collaborators

  • yaochang
  • cxtom
  • moxiaobei
  • meixg
  • xxllxhdj