SFS2X Docs / GettingStarted / client-api-html5
You can setup the API manually or using the npm package manager.
Most examples in the HTML5 tutorials section of this documentation are based on this approach.
If your project makes use of the npm package manager, switch to your project's main folder in a terminal/console window and execute this command:
> npm install sfs2x-api --save
This automatically adds the sfs2x-api entry in the dependancies section of your project's package.json file. You can then use a module bundler and the ES2015 module loading syntax to access the API, like this:
import * as SFS2X from "sfs2x-api";
If you are using npm and a module bundler, but you still want to manage the API library manually (no automatic installation through npm), download the API package from the SmartFoxServer website and unzip it in the project's folder (for example in a libs subfolder). Then change the from clause in the import statement above to "../libs/sfs2x-api-1.7.11" (version number in the name may be different).
All import methods outlined above will expose the API library as a variable called SFS2X, which represents the namespace containing all SmartFox-related classes.