#How to Generate Routes Based on Hierarchy of Data in a Neo4j Database

7 messages · Page 1 of 1 (latest)

thin solar
#

Hello,
I need to generate static routes based on hierarchical data in a neo4j database.
I have a neo4j database that contains hierarchical data like this:
topic1 <- topic2 <- topic3 <- topic4 <- topic5
topic5 <- question1
topic5 <- question2
topic5 <- question3
topic5 <- question4

I need to have static routes like these:

/topic1/topic3/topic5/question1
/topic1/topic3/topic5/question2
/topic1/topic3/topic5/question3
/topic1/topic3/topic5/question4

How can I achieve this in Astro?

I'd appreciate it if you mention the ways that this is achievable in Astro and elaborate shortly on them.

Thanks

#

Please note that a limited subset of the data of the database should be turned into static pages.

valid hare
thin solar
#

Currently, my main requirement is static pages, so I guess I aim for a statically generated site.

turbid bobcat
#

+1 for using neo4j. it's so awesome!
(that's all i had to add).

if it's helpful, what i've got to work is react app -> custom endpoint api in php (with laudis/neo4j-php-client) -> neo4j. I can get json payload from cypher query. from there you could use a [slug] perhaps and make the magic happen

thin solar
#

You mean use the json file retrieved from neo4j as content collections and generate static pages using getStaticPath? Pardon I'm not proficient with Astro.

turbid bobcat
#

i'm just learning astro myself but i believe that's the way. once you've got the json, the source is moot so long as the schema gives you what you need.
also, i'm sure you can pull from neo4j directly in javascript/astro. the php bit is just what fit my backend design.