Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
Baradanikto
Level 9

Localhost as Server?

I've started to develop my first channel and I've based it off one of the examples. In going through the sample code, I noticed references to resources on Roku servers. I plan to set up my own server on a hosting site, but, I don't' have one at the moment. I do, however, have an Apache localhost server that I use for other development. Is it possible to develop my channel using my localhost server? I'd like to write the code so that when I'm finished, all I need to do is change the urls to point to my live server. If it is possible, what functions, classes, etc. should I pay attention to?
Windows desktop software for creating and managing MRSS, JSON, and FireTV feeds @ https://rrirower.wixsite.com/software. No Programming, JSON or MRSS knowledge required.
0 Kudos
4 Replies
belltown
Level 7

Re: Localhost as Server?

Yes, it's definitely possible to develop your channel using an Apache server on your local network. When you specify a url in your Roku code, the Roku doesn't care where the resource is located, whether it's on the local network, or a remote host. It's more a function of your network's router to route the requests to your local server. How you do it depends on your particular router.

In my case, my router has a "DNS Host Mapping" feature that allows me to associate an IP address on my local network with a domain name, so that any requests from a device on the local network (e.g. my Roku) for the specified domain name (e.g. mydomain.com) will be directed to a specified IP address (the IP address of my laptop, e.g. 192.168.0.42). I need to ensure that my laptop's firewall allows the request, and that the server is configured to handle requests for that domain.
https://github.com/belltown/
0 Kudos
joetesta
Level 10

Re: Localhost as Server?

maybe obvious but ideally you set the base URL to a global variable and use that variable everywhere you make an API call - then when you're ready to change it, you only need to change it in that one place.
aspiring
0 Kudos
EnTerr
Level 8

Re: Localhost as Server?

I like @belltown's approach because does not introduce extra abstraction and can be used for testing of even already signed bundle. That said, requires a router that can do the DNS re-directs.

If using app-configurable variable, here is one bonus idea: roAppInfo.getValue() can be used to fetch the base URL from the manifest (i.e. take that out from the code). Is that BFD... eh, not really.
0 Kudos
Baradanikto
Level 9

Re: Localhost as Server?

Thanks for all the replies.  I found a much easier approach.  I have a Synology NAS that allows me to set up web sites.  I built a test web site on the NAS and loaded up some videos.  I then pointed my code to the NAS web site and I am able to test.  This, for me, is a better approach than using localhost as I had originally asked.

Thanks again.
Windows desktop software for creating and managing MRSS, JSON, and FireTV feeds @ https://rrirower.wixsite.com/software. No Programming, JSON or MRSS knowledge required.
0 Kudos