Node.js
Project design
Design the skeleton of the expert final mini app.
Project: Expert final
In this 5-lesson project you will build an expert final: an application skeleton that combines native addons, distributed tracing and performance engineering. Each lesson adds one layer, and the final lesson unifies all four layers in a single report.
The first lesson prepares the skeleton: the setupProject function carries name and version. return { name: 'ExpertProject', version: '1.0' } returns these fields. Each lesson's starting code will contain the previous lesson's solution, so the application grows step by step. The final lesson's integrationReport joins all layers. This project gathers concepts from the earlier expert groups (native addons, distributed systems, performance engineering) into one mini application.
Building the skeleton
The skeleton of a Node.js project carries configuration and identity. The setupProject function returns these in an object; later lessons add layers on top of this skeleton.
Example: const project = setupProject() returns {name: 'ExpertProject', version: '1.0'}. project.name gives the name, project.version the version. This model will be the base as you add native addon, distributed tracing and performance layers. Each layer returns a similar object; the final lesson's integrationReport joins them. Building the skeleton solid in the first step guarantees the later layers sit well.
Exercise Write the project skeleton
Write function setupProject(). Return { name: 'ExpertProject', version: '1.0' }. Print console.log(setupProject().name) and console.log(setupProject().version).
Show example solution
function setupProject() {
return { name: 'ExpertProject', version: '1.0' };
}
console.log(setupProject().name);
console.log(setupProject().version);
Test yourself
-
What does setupProject() return?
function setupProject() { return {name: 'ExpertProject', version: '1.0'}; }
- Only the name
- Only the version
- An empty string
- A name and version object
Show answer
A name and version object — setupProject returns an object holding name and version.
-
Complete the name field
return { ____: 'ExpertProject', version: '1.0' };
Show answer
return { name: 'ExpertProject', version: '1.0' };
-
Match each piece to its role
- setupProject
- Returns the skeleton
- name
- Project name
- version
- Version
- console.log
- Prints output
Next lesson: Native addon