DPDK Architecture  ->  Bootstrap (v3.0.5)

Form
>= v1.21.1

Simple form middleware for Express

Features

  • Opens a form endpoint at /api/form (POST) and expects a body.
  • Includes the default function with configuration from the application config

Bootstrap

Config

No config implemented

Implementation

const form = require('./middleware/form');

this.server.use(form(this.config.form));

Usage

Config

{
  "form": {
    "enabled": false
  }
}

Custom handler

You can implement a custom handler as follows:

const bootstrap = new NextBootstrap(__dirname, process.cwd(), nextConfig);

bootstrap.config.form.formSubmit = (body, complete) => {
  console.log('body', body);

  // Add your own form check here
  if(success) {
    complete(); // Results in status code 1030, Result: "OK"
  } else {
    complete(5030, "Error sending form");
  }
};

bootstrap.init();

Links

No links available

Last modifiedFriday, April 30, 2021, 12:00:21 PM UTC
Last authorColin van Eenige
Commit ID4c7a701