Dynamic URLs in HANA XS

I am trying to implement a simple product catalog using HANA XS Javascript. Directory pages should be displayed on the server side.

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

+5
source share
1 answer

You can create a router function in your application.

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

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

The router function will receive a bullet array. In this function, you need to implement the structure of your application.

For example, every time the fisrt element is a “repository”, load the html of the products in a div.

This is a single user application. Each time loading this page, call this function:

$(document).on('load', function(){ router(); ) 
-1
source

Source: https://habr.com/ru/post/1233753/


All Articles