Giter VIP home page Giter VIP logo

uify-server's Introduction

uify-server

browserify development and production server

npm install --save uify-server

part of uify@1

example

const { createServer } = require('http')
const Send = require('http-sender')()

const uifyServer = UifyServer({
  entry: join(__dirname, 'browser.js'),
  debug: process.env.NODE_ENV === 'development'
  optimize: process.env.NODE_ENV === 'production'
})

const server = createServer((req, res) => {
  uifyServer(req, res, {}, Send(req, res))
}).listen(8080)

see ./example for a complete example with pretty logs.

to run the example:

# in development (debug, watch, and live enabled)
NODE_ENV=development npm start

# in production (optimize and cache enabled)
NODE_ENV=production npm start

usage

UifyServer = require('uify-server')

uifyServer = UifyServer(options)

UifyServer receives an options object:

  • entry: path to the entry source file for browserify bundler (default: "./")

  • debug: enable source maps (default: true)

  • watch: enable bundle watcher (watchify) (default: true)

  • live: enable live reload for development (default: true)

  • livePort: a custom port to bind LiveReload server

  • optimize: optimize bundle for production (default: false)

  • cache: bundle once and cache for production (default: false)

  • pushState: support history.pushState by returning index.html on any requests that accept html (default: true)

  • bundler: a browserify-compatible bundler constructor (default: require('browserify'))

  • bundlerArgs: an object of arguments to pass to the bundler

  • script: the absolute path to serve the JavaScript bundle (default: "/bundle.js")

  • css: optional Cascading StyleSheet in default index.html

  • title: optional title for the default index.html

  • lang: optional language for the default index.html (default: "en")

  • head: optional string to insert into the default index.html between and (default: "<meta name="viewport" content="width=device-width, initial-scale=1">")

  • body: optional string to insert into the default index.html between and

  • favicon: optional favicon url for default index.html page

  • cwd: current working directory to base relative paths on

  • log: a pino-compatible logger instance

UifyServer returns a function of shape (req, res, context, next) => { next(err, value) }

uifyServer(req, res, context, next)

license

The Apache License

Copyright © 2017 Michael Williams

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

uify-server's People

Contributors

ahdinosaur avatar

Stargazers

Andrejs Agejevs avatar Jake Burden avatar Andrew Joslin avatar Iain Kirkpatrick avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

uify-server's Issues

production issue?


Oct 18 21:23:31 cobuy-tapin app/web.1: /app/node_modules/uify-server/index.js:159 
Oct 18 21:23:31 cobuy-tapin app/web.1:     bundleQueue.forEach(queueItem => queueItem()) 
Oct 18 21:23:31 cobuy-tapin app/web.1:                ^ 
Oct 18 21:23:31 cobuy-tapin app/web.1: TypeError: Cannot read property 'forEach' of null 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at onReady (/app/node_modules/uify-server/index.js:159:16) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at /app/node_modules/browserify/index.js:779:13 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at ConcatStream.<anonymous> (/app/node_modules/browserify/node_modules/concat-stream/index.js:36:43) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at emitNone (events.js:91:20) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at ConcatStream.emit (events.js:185:7) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at finishMaybe (/app/node_modules/browserify/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:475:14) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at endWritable (/app/node_modules/browserify/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:485:3) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at ConcatStream.Writable.end (/app/node_modules/browserify/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:455:41) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at Readable.onend (/app/node_modules/readable-stream/lib/_stream_readable.js:570:10) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at Readable.g (events.js:292:16) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at emitNone (events.js:91:20) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at Readable.emit (events.js:185:7) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at endReadableNT (/app/node_modules/readable-stream/lib/_stream_readable.js:992:12) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at _combinedTickCallback (internal/process/next_tick.js:80:11) 
Oct 18 21:23:31 cobuy-tapin app/web.1:     at process._tickCallback (internal/process/next_tick.js:104:9) 

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.