This package has been deprecated

Author message:

Package no longer supported. See https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_deprecations.html#APIBuilderDeprecations-D029

@axway/api-builder-react-engine

2.1.5 • Public • Published

@axway/api-builder-react-engine

A React web route render engine for API Builder.

Since API Builder 2.0 the React web route render engine is not installed by default. The engine is still supported and can be manually registered using this module.

Currently, only React 15 is supported.

Getting started

  1. After creating an API Builder service, you can install the engine:
npm install @axway/api-builder-react-engine --save
  1. Modify app.js and include the following to register the engine:
server.getMiddleware()
	.registerRendererEngine(require('@axway/api-builder-react-engine'));
  1. Ensure that /web/routes and /web/views are created in your service.

  2. Create and export a React component to render in /web/views/myView.jsx:

import React from 'react';
 class MyView extends React.Component {
  render() {
    return <div> hello world </div>;
  }
}
export default MyView;
  1. Create a web route in /web/routes/myRoute.js and make it render the view that you created:
const APIBuilder = require('@axway/api-builder-runtime');
module.exports = APIBuilder.Router.extend({
  name: 'myRoute',
  path: '/myRoute',
  method: 'GET',
  description: '',
  action: function(req, resp, next) {
    resp.render('myView');
  }
});
  1. Start your service and navigate to http://localhost:8080/myRoute to see hello world.

  2. To pass data from the route to the react view pass an object as the second parameter of resp.render(). This will be accessible through this.props in your view. Update /web/routes/myRoute.js and /web/views/myView.jsx:

const APIBuilder = require('@axway/api-builder-runtime');
module.exports = APIBuilder.Router.extend({
  name: 'myRoute',
  path: '/myRoute/:id',
  method: 'GET',
  description: '',
  action: function(req, resp, next) {
    resp.render('myView', { params: req.params });
  }
});
import React from 'react';
class MyView extends React.Component {
  render() {
    const { params } = this.props;
    return <div> {`hello ${params.id}`} </div>;
  }
}
export default MyView;
  1. Restart your service and navigate to http://localhost:8080/myRoute/dave to see hello dave.

License

This code is proprietary, closed source software licensed to you by Axway. All Rights Reserved. You may not modify Axway’s code without express written permission of Axway. You are licensed to use and distribute your services developed with the use of this software and dependencies, including distributing reasonable and appropriate portions of the Axway code and dependencies. Except as set forth above, this code MUST not be copied or otherwise redistributed without express written permission of Axway. This module is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement (General Conditions) located here: https://support.axway.com/en/auth/general-conditions; EXCEPT THAT IF YOU RECEIVED A FREE SUBSCRIPTION, LICENSE, OR SUPPORT SUBSCRIPTION FOR THIS CODE, NOTWITHSTANDING THE LANGUAGE OF THE GENERAL CONDITIONS, AXWAY HEREBY DISCLAIMS ALL SUPPORT AND MAINTENANCE OBLIGATIONS, AS WELL AS ALL EXPRESS AND IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO IMPLIED INFRINGEMENT WARRANTIES, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, AND YOU ACCEPT THE PRODUCT AS-IS AND WITH ALL FAULTS, SOLELY AT YOUR OWN RISK. Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.

Package Sidebar

Install

npm i @axway/api-builder-react-engine

Weekly Downloads

1

Version

2.1.5

License

SEE LICENSE IN LICENSE

Unpacked Size

6.94 kB

Total Files

4

Last publish

Collaborators

  • buildernpmuser
  • nkeranova
  • axway-npm
  • bladedancer
  • ddimonov-axway
  • neon-axway
  • vchauhan
  • mdimitrova
  • pdzhorev
  • axway_alasdair
  • pltod2
  • pbozhkovaxway
  • mbonchev-axway
  • axway-vertex