Welcome, seth.
Handlers take the form function(req, res) {...}
, where req is the request object, and res is the response object.
If you want a lot more information than that, then I recommend you read the official docs for Express: Express 4.x - API Reference (expressjs.com)
I am not too sure what you mean by this. So, I might be going off on a tangent with this:
Let’s serve our first string! In Express, routes takes the following structure: app.METHOD(PATH, HANDLER)
.
This means, a common form of setting up app route logic is:
app.get('/relative-path', handler);
// We just learnt what a handler is:
function handler(req, res) {
// Logic...
}
So, keep in mind, the path is relative. This means, for a route like this very forum page we are on, the route logic might look like this:
app.get('/t/app-get-for-basic-node-and-express-start-a-working-express-server', (req, res) => {
// I like arrow functions for anonymous functions (the handler function above),
// but do not get hung up on it
// In here is the logic to return, in a response, the data for this page
// silly example:
return res.json({postTitle: "App.get for basic Node and Express - Start a Working Express Server"});
// You DO NOT need the 'return' keyword (in this case), but I like being explicit.
If you have any more specific questions, be sure to use the official docs, and ask here for clarification.
Hope this helps