0.0.2 • Published 6 years ago

@nmmascia/babel-plugin-jsx-express v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

babel-plugin-jsx-express

Babel plugin to write express applications using jsx.

Table of Contents

Installation

  1. npm install package
    npm install @nmmascia/babel-plugin-jsx-express --save-dev
  2. Add to your .babelrc
    {
      "plugins": ["@nmmascia/jsx-express"]
    }

Example

Before:

const express = require('express');

<app>
  <get
    path="/hello-world"
    callback={(req, res) => {
      res.send('<p>Hello World!</p>');
    }}
  />
  <listen
    port={8080}
    callback={(err) => {
      if (!err) console.log('started!');
    }}
  />
</app>

After:

const express = require('express');

const app = express();
app.get("/hello-world", (req, res) => {
  res.send('<p>Hello World!</p>');
})
app.listen(8080, err => {
  if (!err) console.log('started!');
})
0.0.2

6 years ago

0.0.1

6 years ago