项目作者: trustyoo86

项目描述 :
parcel-bundler + express + browsersync proxy example
高级语言: JavaScript
项目地址: git://github.com/trustyoo86/parcel-browsersync-proxy-example.git


parcel-bundler + express + browsersync proxy example

parcel-bundler browsersync server proxy example

parcel-bundler’s dev server does not provide a server proxy for the rest api.

so, I bundled through parcel-bundler using js files and use browser-sync and proxy middleware to communicate with the REST api server.

Prerequisites

fork github repo.

  1. git clone https://github.com/trustyoo86/parcel-browsersync-proxy-example.git

Run npm install or yarn install in the project folder

  1. # npm
  2. npm install
  3. # yarn
  4. yarn install

usage

development mode

Run the express server at the terminal

  1. # npm
  2. npm run server
  3. # yarn
  4. yarn server

Run the dev mode of parcel-bundler another termnial

  1. # npm
  2. npm run dev
  3. # yarn
  4. yarn dev

production mode

Run the express server at the terminal with NODE_ENV=production

  1. # npm
  2. npm run prod
  3. # yarn
  4. yarn prod