@platform/react.ssr
Version:
A lightweight SSR (server-side-rendering) system for react apps bundled with ParcelJS and hosted on S3.
21 lines (20 loc) • 589 B
JavaScript
import { micro } from '../common';
import { Config } from '../config';
import * as routes from './routes';
export function create(args) {
const { manifestUrl, baseUrl } = args;
const app = micro.init({
log: {
manifest: manifestUrl,
base: baseUrl,
},
});
routes.init({ router: app.router, manifestUrl, baseUrl });
return app;
}
export function fromConfig() {
const config = Config.createSync();
const manifestUrl = config.manifest.s3.url;
const baseUrl = config.baseUrl;
return create({ manifestUrl, baseUrl });
}