6.0.5 • Published 4 years ago
@bast1oncz/react-server v6.0.5
@bast1oncz/react-server
This package lets you to create a production server for a react application with:
- Very simple setup
- Use controllers that you need and are supported by your platform
Installation
npm install @bast1oncz/react-server --save
Project setup
// serverProd.js
const {createServer, RequireHostController, BotRequestController, FileController, ResourceController} = require('@bast1oncz/react-server')
createServer(process.env.PORT || 3100, [
// keep one host because of SEO purposes (if process.env.REQUIRE_HOST is not defined, controller is not used)
process.env.REQUIRE_HOST && new RequireHostController('RequireHostController', process.env.REQUIRE_HOST),
// serves resource files; the requested url path must start with that last folder pathname
new ResourceController('ResourceController', `${__dirname}/deploy/dist`),
// serves full rendered html to bots
new BotRequestController('BotRequestController', process.env.PROTOCOL || 'http'),
// serves raw html document with application script to users
new FileController('AppDocumentController', `${__dirname}/deploy/app.html`)
])
// package.json
{
"start": "node serverProd.js",
}
Run server
npm start
6.0.5
4 years ago
6.0.4
4 years ago
6.0.3
5 years ago
6.0.1
5 years ago
6.0.2
5 years ago
6.0.0
5 years ago
5.1.2
5 years ago
5.1.1
5 years ago
5.1.0
5 years ago
5.0.1
5 years ago
5.0.0
5 years ago
4.0.3
5 years ago
4.0.2
5 years ago
4.0.1
5 years ago
4.0.0
5 years ago
3.3.3
5 years ago
3.3.2
5 years ago
3.3.1
5 years ago
3.3.0
5 years ago
3.2.1
5 years ago
3.2.0
5 years ago
3.1.2
5 years ago
3.1.1
5 years ago
3.1.0
5 years ago
3.0.0
5 years ago
2.0.3
5 years ago
1.0.2
5 years ago
2.0.2
5 years ago
2.1.0
5 years ago
2.0.1
5 years ago
2.0.0
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago