简体   繁体   中英

Is it possible to build react+redux project to static and place in CDN

I am new in react+redux. Recently I got a task and have no idea.

Is it possible not to use any web server to run my react+redux project?

After building my project, I got a folder of static files.

Is it possible to place those in CDN not having web server eg. nodejs or tomcat?

thanks.

If you do not need save data on server - you do not need it. Take a look on GitHub pages for sample.

No it is not possible without a webserver.

If your app is a static website for example, with no server functionalities (like nodeJs) you could host your builded application (static files) on any simple http server included github pages without setup a nodeJs server.

If you app has some dynamic functionalities, example it use nodeJs to work with server file system or db, you need a node server.

In both cases a http server is necessary to delivery JS/HTML and assets to the browser when requested.

On a CDN you could store some static files, which can be used in your project, which is great if you are building a js library.

In case you do not want to care about the http server you could use any simple hosting solution, example GitHub page, or any hosting which allow running a website with some static files.

Of course you can but you need an HTML page to be parsed by the browser, in which you would include the necessary SCRIPT tags to load and run your React app.

I recommend you give Surge ( https://surge.sh/ ) a try, it's free right now and you can easily host your React project with ease (including the .html files and every asset generated by your build). You can even create a npm script that builds and then deploys from the CLI with a single surge call. Works like a charm!

You can even use a custom domain name, or choose a specific surge subdomain if it's available, like gibbok.surge.sh . ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM