1

I want to learn how to make the simplest possible data lookup function on a website. I don't want to use any of the usual tools such as MySQL or a CMS or any other heavy framework.

I set up an Ubuntu 14.04 server with nginx. I will set up a basic HTML/CSS website on the server. Something very simple.

I do not want to install any database. (However, I might consider SqlLite or similar very simple database if people here strongly suggest it for what I'm doing.) I want this site to be super simple and very easy to maintain. I want to learn how to do this with the simplest tools. (I don't have much website experience, but everything I have done in the past has used either a CMS or some other heavy tool. This time I want to learn a very simple approach.)

As mentioned, I want to add one data lookup function to my website. My site will have a single input field. Using the value in this field, I will look up a corresponding value in a table and return that looked up value to the website.

The "table" can be a text file (or similar).

What is the simplest way to accomplish this?

For this example, let's say the data consists of just two columns. One is the key (a code input on the website) and the other is the value (returned to the user on the website).

Assume there will be thousands of rows of data.

I'm thinking the data could be a simple tab-delimited text file, one record per row. But I'm open to any suggestions.

I'm thinking I could use python or some other language that comes preinstalled on Ubuntu. My requirements are that whatever tools I use must be in the official Ubuntu repositories. And I hope to avoid a lot of layers.

I'm hoping the answer here will include a simple example with code that I can adapt to my needs.

I hope this is a fair question. Thanks.

3
  • My suggestion is to use a simple text file database (format: key=value, CSV, XML, whatever is the best fit for your data) and use your preferred language to query that database. KISS
    – Marco
    Commented Dec 3, 2015 at 8:37
  • How much volume do you expect? Low volume allows simpler, less efficient solutions. High volume demands a tradeoff of simplicity for efficiency.
    – Tom Zych
    Commented Dec 3, 2015 at 9:09
  • It will be low traffic. I don't have a preferred language except that I don't want a large framework or a lot of layers to configure. I'll be learning (or relearning) any language that I use. Yes, KISS. Need a recommendation for a language that will be suitable.
    – MountainX
    Commented Dec 3, 2015 at 14:22

1 Answer 1

0

If you want to look something up in a "table", you need some kind of "database" storing the table. (This might be anything from mysql, sqlite or a simple csv file. - It's your choice.)

If your page has an input field, this usually lives in a form which sends the data to the server. Now the server needs some kind of process that processes that data and return some result. - You web server itself usually only delivers static data and cannot process such request. That is usually done by some kind of CGI program.

That program might be anything from a framework like ruby on rails to a simple perl script or anything like this.

Read a bit about CGI and you will find tons of examples. ;)

For nginx it's a bit more complicated, but have a look at the documentation here.

1
  • If nginx makes it more complicated, I'll switch. CGI might be the way to go...
    – MountainX
    Commented Dec 3, 2015 at 14:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .