@joegesualdo/react-server
Quickly start react server.
Last updated 3 years ago by joegesualdo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @joegesualdo/react-server 
SYNC missed versions from official npm registry.

react-server Build Status

Quickly start react server.

Install

$ npm install --save @joegesualdo/react-server

Usage

import ReactServer from "@joegesualdo/reactServer"
let server = new ReactServer();

server.start("./index.jsx", 'bundle.js');

API

ReactServer()

Creates an instance of the server

import ReactServer from "@joegesualdo/reactServer"
let server = new ReactServer();

server.start("./index.jsx", 'bundle.js');

reactServer.start(entryFilePath, ouputPath, host, port)

Starts the server

Name Type Description
entryFilePath String Path to the entry file
outputPath String The path where you want the code to be rendered
host String The host that you want the server to run on (Default: localhost)
port Number The port you want the server to run on

Viewing in the browser

Create HTML file

$ touch index.html

Start Server

import ReactServer from "@joegesualdo/reactServer"
let server = new ReactServer();

server.start("./index.jsx", 'assets/bundle.js');

Reference the server and output file in your HTML file

<html>
  <body>
    ...
    <script src="http://localhost:8080/assets/bundle.js"></script>
  </body>
</html>

NOTE: Make sure host, port, and outputFile match what was passed to .createServer(...)

Find and View the HTML file

Visit http://localhost:8080

NOTE: Make sure host and port are the ones specified when creating the server

An interactive file system will appear. Navigate to the location of the .html file

Test

$ npm test

Build

$ npm run build

License

MIT © Joe Gesualdo

Current Tags

  • 0.0.1                                ...           latest (3 years ago)

1 Versions

  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |