Suggested answer

The server module is the central SFRA framework object imported at the top of every controller file:

var server = require('server');

It exposes the following key methods:

1. Route registration — server.get(name, ...middleware), server.post(name, ...middleware), server.use(name, ...middleware) for any HTTP method
2. Route inheritance — server.extend(require('controllers/TargetController')) imports all routes from another controller into the current one, enabling extension
3. Route modification — server.append(name, ...middleware), server.prepend(name, ...middleware), server.replace(name, ...middleware) modify inherited routes
4. Exports — module.exports = server.exports() at the end of every controller file exposes registered routes to the B2C Commerce router

Each middleware function in a route receives (req, res, next) — call next() to advance, next(true) to stop the chain and render the current response.

Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.

Community comments (0)

No comments yet.

Sign in or create a free account to add a comment. Comments are moderated before they appear.

Plain text only, 3–2000 characters. A moderator reviews every comment before it is published.