Code Monkey home page Code Monkey logo

quick-local-service's Introduction

quick-local-service

cli for static web page quick-start

Build Status

When you programed a page name index.html\other.html, you can use quick-local-service to start web service to host the page, so you can get the page in the browser like http://127.0.0.1:10086/index.html (index.html is the default page)

how to use

install

$ npm install quick-local-service -g

Arrive the page directory and run the service

$ cd demo
$ qls run

default port: 10086

You can set the port by option -p 8989.

Also, you can set the dir by option -d demo.

$ cd demo
$ cd ..
$ qls run -d demo

config file

init command for generating a config file for options setting named qls.config.js

This is the content of qls.config.js.

module.exports = {
	port:10086,
	dir:"",
	proxy:{}
}

init sets the current path for the option dir.

Also, you can tell qls to use another custom config file by option '-c other.config.js'

$ qls run -c other.config.js

config file for proxy cross-domain interface

in qls.config.js

module.exports = {
	port: 10086,
	dir: '',
	proxy:{
		'/api':{
			host:'http://127.0.0.1:8910',
			pathRewrite:{
				'^/api': '/api'
			}
		}
	}
}

You can see the example directory. (html/proxy.html [qls run], service/other-proxy.js [node other-proxy.js])

Todo:

  1. Interface setting for the ajax request in the page.
  2. [Done] Proxy the cross-domain interface.
  3. [Done] Stop running if the port is used already.

quick-local-service's People

Contributors

shellphon avatar

Watchers

 avatar  avatar

quick-local-service's Issues

Test proxy post request

supertest post to test the post proxy, always get 404 instead of 200. While use example directory handly, post proxy is fine.

Proxy api

Proxy api for proxy cross-domain api, like proxy-table in vue-cli config

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.