# # Quickly Run Examples

Foxit PDF SDK for Web comes with a lot of example projects and files for building the viewer and/or implementing additional functionality. These examples are provided in the `./examples` folder of Foxit PDF SDK for Web. To run them, initialize your (local) web server, open your browser and add the localhost (http://localhost:port) or corresponding IP number URL. The directory list of files will be displayed and you can choose which sample to use.

To quickly get a web server running on your local system, you can use node.js http-server
(opens new window):

    http-server

Additionally, you can append the '-o' command to open directly in your browser window

    http-server -o

You can also use Python's SimpleHTTPServe
(opens new window) module:

    python -m http.server 8000

You may want to refer to Set up local server
(opens new window) for more information.

## # Quickly run samples with Snapshot feature

To use some features that required a backend such as Snapshot and collaboration, your should run `npm install` and `npm start` to quicly start the http server and corresponding backend server at the same time. Below are steps in details.

Before running a sample, you may refer to the `package.json` file inside the SDK package, which looks a below:

    "scripts": {
        "start": "concurrently --kill-others \"npm run start-http-server\" \"npm run start-snapshot-server\" \"npm run start-collaboration-server\"",
        "start-snapshot-server": "node ./server/snapshot/src/index -p 3002",
        "start-http-server": "node ./server/index",
        "start-collaboration-websocket-server": "node ./server/collaboration-websocket-server/src/index.js -p 9111",
        "start-collaboration-server": "node ./server/collaboration-sockjs-server/src/index.js -p 9112"
    },

    "serve": {
        "port": 8080,
        "public": "/",
        "proxy": {
            "target": "http://127.0.0.1:3002",
            "changeOrigin": true
        }
    },
    "collaboration-websocket": {
        "target": "http://127.0.0.1:9111",
        "changeOrigin": true,
        "ws": true
    },
    "collaboration-sockjs": {
        "target": "http://127.0.0.1:9112",
        "changeOrigin": true,
        "ws": true
    }

Next check if and which version of the nodejs and npm are installed on in your computer:

    node -v
    v10.16.0
    npm -v
    6.14.1

Then install the dependencies declared in `package.json`:

    npm install

Finally, run `npm start` command to start servive.

And visit http://127.0.0.1:8080
(opens new window) in browser, you can see all files and examples.

See also

- Start Http Server using Nginx
- Start Http Server using Nodejs