@jb_fmanager/react setup for express.js
Installation
Include the routes and the utility package @jb_fmanager/node-utils
npm i @jb_fmanager/express @jb_fmanager/node-utils
yarn add @jb_fmanager/express @jb_fmanager/node-utils
Options
root
Root folder for the frontend component
prefix
Must match the namespace provided to the manager, default is "api/fm".
maxUploadSize
If you want to override the value provided to the manager. Accepts bytes, ie 5242880 (5mb).
errorHandler
To handle errors your way, optional
Example use
const server = require("express");
const app = server();
const cors = require("cors");
const bodyParser = require("body-parser");
const path = require("path");
require("@jb_fmanager/express")(app, {
root: "public",
prefix: "/api/fm",
errorHandler: undefined,
});
app.use(cors());
app.use(server.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(server.static("./public"));
app.listen(4000, () => console.log("listening on port 4000"));