javascript - Can I host my Reactredux (client and api server) project on github pages? - Stack Overflow

I know I can host my reactredux app on github pages by just serving the bundle.js and index.html, but

I know I can host my react/redux app on github pages by just serving the bundle.js and index.html, but can I also host an api server for the backend that is say username.github.io/api?

The server uses node.js/express and they are separate directories.

Also, can I make the server repository private and still host it on /api?

I looked through the documentation on github pages about creating "projects" but it doesn't make much since to me.

If anyone can shed some light on this, it would be must appreciated.

I know I can host my react/redux app on github pages by just serving the bundle.js and index.html, but can I also host an api server for the backend that is say username.github.io/api?

The server uses node.js/express and they are separate directories.

Also, can I make the server repository private and still host it on /api?

I looked through the documentation on github pages about creating "projects" but it doesn't make much since to me.

If anyone can shed some light on this, it would be must appreciated.

Share Improve this question asked Sep 6, 2016 at 23:39 natephnateph 798 bronze badges 1
  • 1 No. GitHub Pages is for static files, not servers. – Jed Fox Commented Sep 6, 2016 at 23:40
Add a ment  | 

4 Answers 4

Reset to default 3

I suggest you run your front-end code on github while having an externally hosted api on say, AWS or google cloud.

Amazon and google both provide free packages for small scale operations!

This way you can have your github page request data from AWS or google cloud!

No. GitHub Pages are static. They're generated using a variation of Jekyll, a templated flat site generator. As such, they're only flat HTML, CSS and Javascript.

You could host your frontend React application in them, but not server-side application code or a database.

You are not allowed to run any custom server code on Github pages, you can only host static files (HTML, images, front-end javascript etc).

You could do that if you are able to convert your code to static HTML + Resources (JS+CSS+IMAGES+FONTS..). To do that, it is remended to use webpack

Once you finish coding, you build your project using :

NODE_ENV=production node_modules/webpack/bin/webpack.js --config webpack.config.prod.js

This will generate static HTML + JS of your code .

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745147183a4613699.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信