Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Babel plugin to write express applications with JSX

License

Notifications You must be signed in to change notification settings

nmmascia/babel-plugin-jsx-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  1. 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!');
})

About

Babel plugin to write express applications with JSX

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published