GithubHelp home page GithubHelp logo

vscode-express's Introduction

Express

Hosts current workspace with Express web server in Visual Studio Code

Demo showing how Express extension works

Usage

To host your current workspace in Express with default port number (80), and then open in your default browser.

  • Bring up Command Palette (F1, or Ctrl+Shift+P on Windows and Linux, or Shift+CMD+P on OSX)
  • Type or select "Express: Host current workspace and open in browser"

When Express is up and ready, an icon will show up in the status bar Status bar item showing Express listening to port 80. You can click on it to open your site in browser.

Commands

Command Title
express.hostWorkspace(portNumber) Express: Host Current Workspace
express.hostWorkspaceAndOpenInBrowser(portNumber) Express: Host Current Workspace and Open in Browser
express.hostWorkspaceWithRandomPort Express: Host Current Workspace with Random Port Number
express.hostWorkspaceWithRandomPortAndOpenInBrowser Express: Host Current Workspace with Random Port Number and open in browser
express.openInBrowser Express: Open Currently Hosted Website in Browser
express.showOutput Express: Show Output
express.stopServer Express: Stop Server

Preferences

By default, the Express server is hosted on port 80. You can configure it to different port in preferences.

// Specifies the port number the Express server should listen to
"express.portNumber": 80,

// Determines whether to omit informational messages
"express.omitInformationMessage": false,

// Specifies the path to be hosted on Express, relative to the workspace root
"express.relativeRoot": null,

// Specifies the minimum port number to use for random port number
"express.randomPortNumber.min": 8000,

// Specifies the maximum port number to use for random port number
"express.randomPortNumber.max": 8999,

// Determines whether to show output on server start
"express.showOutput": true,

Tips: Settings can be shared across team when overridden by workspace settings and checked into source control.

Change log

  • 0.0.4 (2016-03-24): Update extension description
  • 0.0.3 (2016-03-16)
    • Show every request in output when server start
  • 0.0.2 (2016-03-16)
    • Support both pre-configured or random port number
    • Call vscode.commands.executeCommand('express.hostWorkspace', 8080) to host on port 8080
    • Automatically stop server when extension is being deactivated
  • 0.0.1 (2016-03-14): First public release

Contributions

Love this extension? Star us!

Want to make this extension even more awesome? Send us your wish.

Hate how it is working? File an issue to us.

vscode-express's People

Contributors

compulim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vscode-express's Issues

path specification

What values can be set here? How do you refer to the root in order to see the directory in the browser instead of Cannot GET /

 // Specifies the path to be hosted on Express, relative to the workspace root
 "express.relativeRoot": null,

Add CORS support

I would like to have a way of enabling CORS.

Minimum implementation could be a boolean in the workspace settings ("express.cors.enabled") and would allow all.

I'm not sure how far people would like to configure this, but taking a look at expressjs' CORS options

Ill make a PR if interested

Step-by-step instructions and debugging

I can get the server started no problem. But then I get the error "Cannot GET /" on the page. I can't run a specific page of the website, and I can't figure out how to do so since there is little to no documentation.

Please make proper instructions.

Want short cuts and open current file

First,thank u for this useful extension!

I hope that,add short cuts to this extension,which can make it more simple to use.

Second,after hosted a website,i need to type in some files' path by myself to view it.
So i want a command to open current file while the website has been hosted.

๐Ÿ˜„

Vulnerability information report

Hello,

After cloning the repository, I performed a security analysis and discovered a critical vulnerability associated with it. For security best practices, I believe it's unwise to disclose the vulnerability details publicly. Since I was unable to locate any information on how to report security issues, could you guide me on the appropriate procedure or provide a secure point of contact to report this finding?

express.openInBrowser

Good extenstion.
Can you add 'vscode.window.activeTextEditor.fileName' when click in statusBarItem ?
context.subscriptions.push(vscode.commands.registerCommand('express.openInBrowser', () => {
const portNumber = server.portNumber;
if (portNumber) {
openInBrowser(portNumber + '/'+vscode.window.activeTextEditor.fileName );
} else {
vscode.window.showErrorMessage('No Express server is running');
}
}));

Can you add fileRelate

I'am sorry ,my english is poor.I hope you can understand what i am talking...

when i click port:xxxx.. The brower is open and just in the rootFloder ..is my "index.html" is not in the rootFloder ,I have to complete the url by myself ,can you listening what file i'am opening and when i click "port:xxxx" it can complete the right url?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.