http/ws development server as part of basisjs-tools
server
server
command launch a server instance:
> basis server
By default current folder becomes server root (you can change it using --base
option). You also can set listening port with --port
option on command run or define it in config (useful when launch several servers). By default server listen port 8000
.
> basis server -p 8123
Server run at http://localhost:8123
Server caches files you access to and inject it into html page (via window.__resources__
). This approach speeds up page loading with many files.
Also it watches for files changes and send new file content to client if neccessary (using socket.io
and basis.js
infrastructure). When you use this server you usually don't need to refresh page when you change .tmpl
, .css
, .json
or .l10n
files.
License
MIT License.
1.0.0 (September 6, 2017)
- Extracted to separate repo/module from basisjs-tools
- Changes since being a part of
basisjs-tools
- Changed to use rempl as backend for devtools
- Used slim version of
socket.io-client
- Added
fork()
method - Added notification message for parent process when server is started
- Added SSL support. Https listen on the same port as http and enables by
--ssl
option. SSL certificate can be specified by --ssl-cert
and --ssl-key
options (certificate will be generated automatically when options are not used). - Fixed issue when requested file has escaped chars (use
decodeURIComponent
for pathname
) - Fixed value for
href
attribute of <base>
when url is rewritten - Removed
--inspect
option - Minor fixes and imrovements
Warning! For now /basisjs-tools/devpanel
doesn't work for basis.js
(1.11.0 at the moment), since basis's devpanel should migrate to rempl.