@velop/server

Serve one or more react apps! - Custom routes, HotReloading, Authenticated Apps/routes, Relay, Webpack ++

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@velop/server
0.3.26 years ago6 years agoMinified + gzip package size for @velop/server in KB

Readme

velop-server
Greenkeeper badge Travis npm npm Coverage Status code style: prettier
Serve one or more React apps with one simple call. Supports Universal rendering, Webpack, HotReloading, Relay, Passport, FoundRouter, Graphql out of the box! Fully editable setup with a simple set of functions and commands. You can also add custom routes or static paths at your needs. Even add a authentication layer on top of the routes or apps you what! All this is possible with a simple set of functions.

Why?

This is not a standardization nor a boilerplate or startupkit. This is a engine that can serve the js for you in the way you want. A developer should not put resources into setting up core server, only provide details of what they want to serve and how to do it. The rest will @velop/server take care of!

Why not Next.js?

NextJS is a great tool for creating a boilerplate setup that you can edit for your needs. Full cretid to Zeit
for some awesome work! But it has some core problems like serving multiple apps, custom static folders, authentication to routes, or just serving other then react apps. @velop/server aims to solve these problems and with a more simple solution. Calling functions and not configuring files.

Table of Contents

Installation

$ npm i -S @velop/server
or
$ yarn add @velop/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 Server = require('@velop/server')

var server = new Server({
  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

Thanks to:

and many more ++