Access to query parameters without using Express


#1

I know that I have access to the URL’s query parameters if I use express.

But I have a simple script that just uses console.log for output. Is there a way for such scripts to gain access to the query parameters?

Thanks,
Larry


#2

Yes, you could use the node HTTP module: https://www.w3schools.com/nodejs/nodejs_http.asp

Why don’t you want to use Express?


#3

Thanks Tim. My plan is to demonstrate API usage with Glitch. For examples that are essentially command line examples, there is no need to introduce Express into the code. But I do need access to the query parameters for setting per-student parameters.


#4

Gotcha. I do the same thing for my students with Java web apps - we start with servlets because you can see what’s really happening before you use magic like Spring.