@itznotabug/appexpress-jsx

0.0.4 • Public • Published

AppExpress JSX View Engine

This module allows you to use React components in your Appwrite Functions with AppExpress.

Here's a Live Demo for reference!

Installation

Add the view engine like this -

npm install @itznotabug/appexpress-jsx

Usage

// import
import jsx from '@itznotabug/appexpress-jsx';
import AppExpress from '@itznotabug/appexpress';

// setup
const express = new AppExpress();

// configure options if you want.
// jsx.options({ useStaticMarkup: true });
express.engine('jsx', jsx.engine); // js, jsx, tsx

// render jsx and pass props
express.get('/jsx', (req, res) => {
    res.render('index', { name: 'JohnDoe' });
    // or `res.render('index.jsx', { name: 'JohnDoe' });` if you have multiple view engines registered.
    // or `res.render('index.tsx', { name: 'JohnDoe' });` if you have multiple view engines registered.
});

Note: This view engine employs the same callback logic as express.js, making it compatible for use with express.js applications as well.

Readme

Keywords

none

Package Sidebar

Install

npm i @itznotabug/appexpress-jsx

Weekly Downloads

0

Version

0.0.4

License

Apache-2.0

Unpacked Size

6.21 kB

Total Files

4

Last publish

Collaborators

  • itznotabug