@jsenv/exploring-server

3.11.0 • Public • Published

jsenv exploring server

npm package build codecov

Introduction

@jsenv/exploring-server starts a server creating an html page listing your project files.
Each link goes to an url where your JavaScript file will be executed.
Thanks to this, any file or your project can become an entry point. You can use it to debug a file in isolation or even to create a storybook.

It has the following exports:

  • startExploringServer

How to use

To understand how to use jsenv exploring server let's use it on a "real" project.
We will setup a basic project and start an exploring server inside it.

Steps to start exploring server on a basic project

  1. Create basic project file structure

    — see ./docs/basic-project

  2. Install dependencies

    npm install
  3. Start the exploring server

    node ./start-exploring-server.js

Using the exploring server

A first main server will start. This one is used by the whole jsenv project.
A second server will start. That's the one we're interested in right now. The url http://127.0.0.1:3456 is logged in your terminal.

Once server is started you can navigate to http://127.0.0.1:3456 and you will see an html page listing the files you can explore.

exploring server chome screenshot

  • If you go to http://127.0.0.1:3456/src/hello.js page displays Hello world. It shows that if your file execution renders something, you can see the effect in your browser.
  • If you go to http://127.0.0.1:3456/src/text.js nothing special will happen because /src/text.js is just a module with an export default.
    It shows that even if your file do not render anything, you still can use this functionnality to debug your file.

Here is a gif showing me browing basic project files:

recording of me exploring a project using chrome

If you want to know more about startExploringServer, there is a dedicated page for that.
— see startExploringServer documentation

Installation

npm install --save-dev @jsenv/exploring-server@3.7.0
yarn add @jsenv/exploring-server@3.7.0 --dev

Readme

Keywords

none

Package Sidebar

Install

npm i @jsenv/exploring-server

Weekly Downloads

8

Version

3.11.0

License

MIT

Unpacked Size

701 kB

Total Files

17

Last publish

Collaborators

  • dmail
  • jsenv-admin