# y-server-plugin-ejs

> y-server ejs engine plugin

Latest version **0.0.2** (published 2017-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install y-server-plugin-ejs
pnpm add y-server-plugin-ejs
yarn add y-server-plugin-ejs
bun add y-server-plugin-ejs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2017-09-14 |
| First published | 2017-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | SmadeyZhang |
| Maintainers | smadey |

## Links

- npm: https://www.npmjs.com/package/y-server-plugin-ejs
- Repository: https://github.com/yued-fe/y-server-plugin-ejs
- Homepage: https://github.com/yued-fe/y-server-plugin-ejs#readme
- Issues: https://github.com/yued-fe/y-server-plugin-ejs/issues
- npm.io page: https://npm.io/package/y-server-plugin-ejs

## Dependencies (2)

- [ejs](https://npm.io/package/ejs.md) ^2.5.7
- [colors](https://npm.io/package/colors.md) ^1.1.2

## Recent versions

- 0.0.2 (latest) — 2017-09-14
- 0.0.1 — 2017-08-29

## README

# y-server-plugin-ejs

y-server-plugin-ejs is a [y-server](https://github.com/yued-fe/y-server) plugin to provide ejs engine.

## Install

```bash
npm install y-server-plugin-ejs
```

## Usage

```javascript
const yServer = require('y-server');
const ejsPlugin = require('y-server-plugin-ejs');

yServer({
  plugins: [
    ejsPlugin({
      viewDir: path.join(__dirname, './view'), // 模板根目录
      renderAdapter: (result) => {
        result.$render = true;
        return result;
      },
    }),
    (app) => {
      app.get('/', (req, res) => {
        res.render('index.html', {
          code: 0,
          data: {},
          msg: '成功',
        });
      });
    },
  ],
});
```

## Notes

* `viewDir` is the base directory of view.
* `renderAdapter` is the adapter of render data.

## License

[MIT License](http://en.wikipedia.org/wiki/MIT_License)

---
_Source: https://npm.io/package/y-server-plugin-ejs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
