5

I'm trying to implement simple product catalog using HANA XS Javascript. Pages of the catalog should be rendered on the server side.

How can I handle "dynamic" URLs based on data read from HANA database? For example, http:///myapp/store/[product-slug]/ (products are stored in HANA database and have unique slugs).

Fedor
  • 1,392
  • 1
  • 17
  • 30
  • Are you searching for a [Rest](https://de.wikipedia.org/wiki/Representational_State_Transfer) Service for HANA? I just found the [Orion API](https://scn.sap.com/community/developer-center/hana/blog/2014/12/10/sap-hana-sps-09-new-developer-features-rest-api) – k4yaman Oct 25 '15 at 02:33
  • @k4yaman no, I need to render static web pages – Fedor Mar 10 '16 at 21:55

1 Answers1

-1

You can create a router function on your application.

On 'http:///myapp/index.html', create a javascript function called 'getSlug'. This function get the path url and split string based on '/', the result will be: [0] store [1] [product-slug]

Create a function to router the content. You need to have column in product table with slug.

The router function will receive an array of slugs. On this function you need to implement the structure of your app.

For example, every time that fisrt item is 'store', load html of products into the div.

This is a kind o single page application. Every time that load this page, call this function:

$(document).on('load', function(){
    router();
)
Caio Melzer
  • 130
  • 3