extensive-react-server v2.5.12
extensive-react-server
Extensible server for hosting a React universal apps(Isomorpic). Host one or more apps, with or without authentication. Supports: Graphql, Relay, Passport, Webpack, HotReloading, custom webpack configs for every route, custom routes ++
Why?
Boilerplates, startup-kits, setup server, webpack, hot reloading +++ its a jungle!!
extensive-react-server
has support for everything out of the box, and you can get up and running with 3 lines of code.
Table of Contents
Installation
$ npm i -S extensive-react-server
or
$ yarn add extensive-react-server
Getting started
Create a awsome react app app/Routes.js
with found routing/navigation
Remember you must return a found makeRouteConfig
.
Create a new file server.js
with contents:
const ExtensiveReactServer = require('extensive-react-server')
var server = new ExtensiveReactServer({
environment: 'development',
hostname: 'localhost',
port: 3000,
});
//To add a file or a folder with routes?
server.addRoute('routes/');
//To add a React app with serverside render support
server.addReactRoute(
'', // URI prefix
path.resolve(process.cwd(), 'app/Routes.js'), //path to APP file
);
//Start server!
server.start();
Create a .babelrc
file for your needs:
{
"presets": [
"react",
"stage-0"
],
"plugins": [
"transform-runtime"
],
"env": {
"development": {
"plugins": ["react-hot-loader/babel"]
}
}
}
Run the server:node server.js
Good luck!
Features
- koa - Koa server, why? its faster than express
- koa-compress - zlib compressing
- koa-etags - support for etags
- koa-helmet - header/content security
- koa-logger - development logging
- kcors - Cross-Origin Resource Sharing(CORS)
- passport - authentication layer
- ddos - dos/ddos protection
- webpack - module bundler
- graphql - GraphQL
- relay - Relay
- found - Found router
- react-hot-loader - Tweak React components in real time
- webpack-hot-middleware - Webpack hot reloading
- winston - Winston logger
Todo:
- Add support for custom routes
- Add support for multiple React apps with serverside render (SSR)
- Allow middleware for react paths (example: authentication)
- Add support for Passport
- Add support for Relay
- Add support for custom index.html file for SSR
- Create examples
- Better documentation
Thanks to:
- taion for found router
- sokra for webpack
- glenjamin for webpack hot middleware
- richardscarrott for webpack hot server middleware
- jkettmann for a good startupkit and many more ++
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago