Hosting a Plugin on a Local Server
Last updated
Last updated
Before you can preview a cloned plugin in FormIt, you need to host it on a local server.
You have the option of starting the server inside Visual Studio Code, instead of a separate terminal window. **** Before opening a terminal, make sure the right folder is opened in Visual Studio Code.
View > Terminal (or shortcut Ctrl + `)
An HTTP server that works well is npm's http-server.
First, you will need to download and install NodeJS, if it's not already installed.
If you encounter errors in the following steps, try restarting your computer to complete the NodeJS installation.
In the Command Prompt, enter the following to install npm's http-server globally (a one-time setup).
npm install http-server -g
Once the setup is complete, run the following command in the terminal to start your npm http-server:
http-server
Tip 1: In case of any issues with running the http-server (installed globally or locally), it may be helpful to run it directly via npx:
npx http-server
Tip 2: For Windows 10/11 users, if you encounter an error when running a script on your new machine, this may be due to the settings being disabled. To fix this:
Launch PowerShell script as an administrator
Enter: Set-ExecutionPolicy RemoteSigned
To develop for FormIt Web, simply run the following command instead:
http-server --cors
You can verify your server by navigating to the following address in your web browser:
http://localhost:8080
You should see your project folder files in the browser window.
**If you use a different web server than npm, the default address/port might be different.