@formio/appserver
v2.12.2
Published
A highly performant and extensible Application Server for Form.io Multi-Tenant Deployments.
Keywords
Readme
Form.io App Server
The Form.io App Server is a performant run-time application server used to serve single project templates (including forms, resources, roles, etc) at a single deployed endpoint.
It's goals are as follows:
- Provide a single project runtime server where non-submission resources are cached in memory.
- Enable multi-tenant / multi-database deployments.
- Provide extensible server-side functionality, like custom actions.
- Support other databases besides MongoDB compliant databases for submission data.
Installation
To use this library, you must mount it within an Express.js application. As an example, you can create a simple Express.js application with this library by first creating a new Express.js application and then install and use the Server as follows.
npm install --save @formio/appserverThen within your server.js file, you would add the following.
const express = require('express');
const app = express();
const { Server } = require('@formio/appserver');
(async function bootup() {
// Create the server.
const server = new Server();
// Add the server router.
app.use(await server.router());
// Start server.
app.listen(process.env.PORT, () => {
console.log(`Server running on port ${process.env.PORT}`);
});
})();License
The Form.io App Server does require a license to run. If you are interested in trying out this technology, please contact us @ https://form.io/contact-us
Running Locally
To run this library locally, you can clone the repository, and then npm install.
yarn installThen do the following.
cp .env.example .envNow, within the .env file, modify all of the environment variables to be the correct values. Next, you can run the server using the following.
node indexEnvironment Variables
This library uses environment variables to configure the configurations required to run the server. These are as follows.
| Variable Name | Required | Description | Example | |--------------|-----|-----------|-----| | MONGO | yes | Your MongoDB Connection string to use the default DB. | mongodb://localhost:27017/appserver | | PROJECT | yes | The endpoint for your deployed Form.io Enterprise project. | https://mydeployment.com/myproject | | PROJECT_KEY | yes | The API Key for your deployed Form.io Enterprise Project. | abc123 | | APPSERVER_LICENSE | yes | Your License Key for this App Server deployment. | | | PORT | no | The port that your server will run on. Default 3005 | 3005 | | JWT_SECRET | yes | The key used to protect your JWT authentication tokens. | YOUR_SECRET_KEY | | JWT_EXPIRE_TIME | no | The number of minutes to expire your JWT token. | 240 | | PORTAL_SECRET | no | Provides the ability to connect to the App Server via the Remote Environment Connection within your Developer Portal. | YOUR_SECRET_KEY | | PROJECT_CACHE | no | Disables the cache for project resources (such as Project template, Project Settings, and Access Settings). Default "true" | true | | MONGO_CONFIG | no | Additional configurations to add to the DB connection string | {} |
Enjoy
- The Form.io Team
