Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/floatdrop/express-render-jsx

Render jsx files from express
https://github.com/floatdrop/express-render-jsx

Last synced: 22 days ago
JSON representation

Render jsx files from express

Awesome Lists containing this project

README

        

# express-render-jsx [![Build Status](https://travis-ci.org/floatdrop/express-render-jsx.svg?branch=master)](https://travis-ci.org/floatdrop/express-render-jsx)

> Render jsx templates from Express

## Install

```
$ npm install --save express-render-jsx
```

## Usage

```js
var app = express();
var expressRenderJsx = require('express-render-jsx');

app.set('views', __dirname + '/views');
app.set('view engine', 'jsx');
app.engine('jsx', expressRenderJsx());
```

Your views should be node modules that export a React component. Let's assume you have this file in `views/index.jsx`:

```jsx
var React = require('react');

var HelloMessage = React.createClass({
render: function() {
return

Hello {this.props.name}
;
}
});

module.exports = HelloMessage;
```

## License

MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)