Redirect to a specific link routing - node.js

i'm using express to make a electronic document management (EDMS) in node.js.
After the user login, I'll have a simple box, where he's chosee between two options:
a. search XML files
b. search Other Documents files
is there a way to create specific routing for, if he chooses to go only with XML, all links i'll be under that routing?
Something like xml/home/ and otherDocuments/home/ and the rest of the methods ill be xml/something and otherDocuments/something?

Related

Node JS - routing using list of routes and navigating back and forth

I am fairly new to NodeJS. I am working on an simple survey application which has a list of static pages. I have 10 forms in the application and thus looking to have 10 pages, one form per page. My requirements are:
Best way to maintain the static routes?
How to navigate the pages back and forth?
When I navigate between pages, the details which are already entered should not be erased and must be present?
Can someone help me on this.

How to graphically select a element on a page outside the own website

So, I have a website where i need to insert a lot of products from our suppliers' website, and I would like to automate it.
I was reading this question, that would solve most of the "front-end" part, and on the backend than I only need to get the link of the page, and use a basic web crawler library to search on that page the given selector.
However I'm missing the part where I inject a possible JS library on the supplier website, in order to allow others to select the element with the mouse, and not to find it using something like the Chrome console.
I was thinking about fetching the source page on the server side, and that returning it, but all the resources like CSS, JS, images, will be blocked by CSRF protection, and so here's my question:
Are there ways to do this in any way?
Edit:
ok maybe it's not so clear what I want to achieve... here's how thing should go:
Someone decides to insert a new supplier, that he should set the CSS path for the product name, the CSS path for the product description etc etc (section where i appreciate suggestion), and then he only needs to insert the products links and the server will get the informations using the CSS path inserted before.

How to load resources based on link in react

I want to create a web application using react in which I want to load a page based on the link used, But I know that in react whenever you visit a direct link the entire app is reloaded and you have to navigate to that page using buttons or links provided in the app, I want to generate a temporary link for users which will contain the information about the data to be provided which the back end will check and retrieve from database and provide to the front end, This link will have a duration like for 24 hrs or something and will have an auth token, Can anyone please help me with how I can do that?
React Router is a library that can handle this type of operation and is used in many, many apps. Among other things, it can parse URLs and render different content based on the URL, query parameters, and more.

Serve custom javascript to browser via Node.js app

I developed a small node.js app in which I can configure conditions for a custom javascript file, which can be embedded in a webpage, and which modifies the DOM of that page in the browser on load. The configuration values are stored in MongoDB. (For sake of argument: add class "A" to DOM element with ID "B" )
I have difficulties to figure out the best way to serve requests / the JavaScript file.
Option 1 and my current implementation is:
I save a configuration in the node app and a distinct JavaScript
file is created for that configuration.
The page references that file which is hosted and served by the server.
Option 2 and where I think I want and should go is:
I saves a configuration (mongodb) NO JavaScript file is created Pages
a generic JavaScript link (for instance: api.service.com/javascript.js)
Node.js / Express app processes the request, and
returns a custom JavaScript (file?) with the correct values as saved in mongodb for that configuration
Now, while I believe this is the right way to go about it, I am unsure HOW to go about it. Any ideas and advise are very welcome!
Ps: For instance I wonder how best to authenticate or identify the origin, user and requested configuration. Shall I do this like: api.service.com/javascript.js&id="userID" - is that good practice?
Why not serve up a generic Javascript file which can take a customized json object (directly from mongodb) and apply the necessary actions? You can include the json data on the page if you really need to have everything embedded, but breaking up configuration and code is the most maintainable approach.

Enabling search for my site that uses rss

my site is here
The main flash app uses rss (or xml) to display data. I'm wondering how I can add search functionality to it. One idea is to create multiple custom rss for each filter and search query, but I thought that it would be a nightmare to add more data later on. So I'm wondering if there's another way to do it?
RSS feed is located here My site is hosted at edicy.com and I can't install any other server side extensions other than use XHTML, XML, HTML and Javascript.
Index your data using a search engine like solr or sphinx then have your flash app talk to the server to post a query to it and retrieve the results in XML

Resources