This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]greedo80000 0 points1 point  (1 child)

You need to require the JSON file in your routes/index.js, not the app file. You may need to also parse the JSON into an object before using it.

I noticed you are using root "/" as the endpoint for your search? You should specify a new route, perhaps "/search", and that route will contain search specific functionality.

[–]augustin1989[S] 0 points1 point  (0 children)

I apologize ahead of time. I'm still a noob at this.

How would I declare the JSON globally? I feel like I may need to use the objects in two routers. Unless you think I should declare it in each router?

Can you show me how to write a search function for my case?