3 ms·
Could you build a Rest API or website without internet access?
Let's imagine the internet just went down, and your in a small village. Everyone is an experienced software engineer, and you have Ubuntu installation media and 30 working laptops( assume they have Windows installed already).
Could you get a website up to allow for basic CRUD stuff, like tracking how many apples you have left?
I know Ubuntu has a basic web server built in, as well as Python.
- schwartzworld 5y agoA website is a document. An API is a computer program. Neither of these requires an internet connection. localhost:3000 can make requests against localhost:3001 just fine. I make websites at home and serve them on my local network. Anybody attached to our wifi can visit them, even if that wifi isn't connected to the larger internet.
- speedgoose 5y agoFor sure if python is allowed, it’s not rocket science.
- mikewarot 5y agoThe unstated assumption is that there exists some form of networking hardware that can be used. With no wifi or ethernet, all those machines are stand alone boxes. Assuming some form of networking, I'd get DHCP configured, and make sure they could all ping one of the machines chosen as a server. Why bother with Ubuntu, they're already working with Windows, and thus no driver issues to work out, etc. I'd then write a server and clients in Lazarus, skipping the whole web thing completely. Yes, I could do it in a python CGI, but why?
- 999900000999 5y agoYou wouldn't be able to download Lazarus in this scenario. I know Ubuntu comes with Python. I think you could get two PCs to communicate via Bluetooth, plus I imagine a cell phone used as a mobile hotspot ( without actual internet) could be used as a router.
- mattbrewsbytes 5y agoI get the premise behind the question and you're seeking a technical answer but this is probably a good example of how we like to over-engineer stuff. If its a small village do you need laptops to track apple counts? What farmer counts their apples? What small village problem is being solved here? Setting those questions aside and assuming Windows has zero way to track apples (Excel could work). In that case, Ubuntu media should come with the other parts of the LAMP stack (apache, mysql, perl/php/python). Pick one language and write the simplest CGI scripts possible to track apples. I'd probably pick Perl since I used it back in the days of CGI scripts. You might even be able to skip the MySQL part and just do file IO, there is a max of 29 users. If you get stuck, use man pages for help.
- 999900000999 5y agoThat's a good point. Another way to ask the question, if your in a nation cut off from the internet for whatever reason could you bootstrap an intarnet ? Assume you have full support of the local authorities. My internet went down the other day, making me think of this.
- mikewarot 5y agoCommunities set up wireless mesh networks all the time. The internet is just a network of networks. You have to have your own DNS, time and address assignment services, and you're good to go.
- jjice 5y agopydoc -b Now that I have an offline browsable version of the Python docs, this is super easy. I'd use the built in HTTP server that they don't recommend you use for production (since we're living in a village). From there, building a CRUD app is pretty straight forward. Python has SQLite built in as well.