This is a question related to OpenLayers/jQuery without CDN?. I was looking to copy a minimal set of files on js/css files to replace online CDNs, so that I can run a test server on localhost without internet access.
I heard from the comments that it is possible to use node.js
to run a test server entirely on the localhost. This is a interesting approach. I was wondering what are the general steps, e.g. to run such a webgis server with (or that matches) typical options like OpenLayers and GeoServer?
Answer
I got OL3 working locally using nodejs by following (some of) the instructions on from OL3 github repo. I did the following on Ubuntu.
1). Clone OL3 from github
git clone https://github.com/openlayers/ol3.git
2). Cd to the ol3 directory (where package.json lives) and install node dependencies
npm install
If this fails with lots of bizarre node errors (possible), run
sudo apt-get install node-js legacy
which was taken from this SO post.
3). Run the python script to setup a local server
./build.py serve
which under the hood runs tasks/serve.js
, at which point, if you are lucky and have sacrificed enough goats, you will see the message,
info serve Listening on http://localhost:3000/ (Ctrl+C to stop)
4). Navigate to http://localhost:3000/examples
and you should have all the OL3 examples working locally and be able to see the uncompressed Javascript files in the sources tab of your favorite web developer console.
Looking at some of the source code, I can only take my hat off to some really impressive stuff from the OpenLayers 3 dev team.
No comments:
Post a Comment