A highly performant and extensible Application Server for Form.io Multi-Tenant Deployments.
npm install @formio/appserverIt'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.
```
npm install --save @formio/appserver
Then within your server.js file, you would add the following.
`js
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});`
});
})();
``
yarn install
Then do the following.
``
cp .env.example .env
Now, 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 index
| 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