🚀HTTP2 custom server for CRA projects. Boost your App load times!
yarn add cra-http2-push-server
npm install --save cra-http2-push-server
You have to define the following
#.env BUILD_DIR=/home/user/project-name/build ADDRESS=localhost PORT=8080 ENABLE_HTTPS=true CERT_DIR=/home/user/project-name/certs
BUILD_DIR: Location to the build directory of your create-react-app. It has no default value.
ADDRESS: The ip where it will be running, if not passed it will use 'localhost' as default.
PORT: The port where it will be exposed, if not passed it will use '8080' as default.
true || false. This is necessary for http2 server, to know how it will execute. If 'false' or undefined it will use http for http2.
ENABLE_HTTPSis set to 'true', then you have to specify your certificate directory. The server will expect your files to be named like server.crt, server.key, server.csr.
After having this
enviromental values defined you then can import the server, and start it:
# index.js const Http2Server = require('cra-http2-push-server'); Http2Server.start();
If you found a bug, or you have an answer, or whatever. Please, open an issue. I will do the best to fix it, or help you.
Of course, if you see something that you want to upgrade from this library, or a bug that needs to be solved, PRs are welcome!
Distributed under the MIT license. See LICENSE for more information.