const http = require('http'); const url = require('url'); const PORT = process.env.PORT || 3000; // Movie data const movieData = { title: "Star Trek: First Contact", year: 1996, tagline: "Resistance is futile", summary: "The Borg travel back in time to prevent Earth's first contact with an alien species. Captain Picard and his crew pursue them to ensure that Zefram Cochrane makes his maiden flight reaching warp speed.", characters: [ { name: "Captain Jean-Luc Picard", actor: "Patrick Stewart", role: "Captain of the USS Enterprise-E, haunted by his past assimilation by the Borg" }, { name: "Commander William Riker", actor: "Jonathan Frakes", role: "First Officer who leads the away team to help Zefram Cochrane" }, { name: "Lt. Commander Data", actor: "Brent Spiner", role: "Android who is captured and tempted by the Borg Queen" }, { name: "Borg Queen", actor: "Alice Krige", role: "Leader of the Borg Collective who attempts to seduce Data" }, { name: "Zefram Cochrane", actor: "James Cromwell", role: "Inventor of warp drive who makes first contact with the Vulcans" }, { name: "Lily Sloane", actor: "Alfre Woodard", role: "Cochrane's assistant who helps Picard confront his demons" } ] }; // HTML Templates function renderHTML(title, content) { return ` ${title} - Star Trek: First Contact

🚀 ${movieData.title}

"${movieData.tagline}"

${content}
`; } function homePage() { return renderHTML('Home', `

🖖 Welcome to First Contact!

This application is dedicated to one of the most beloved Star Trek films. Explore information about the movie, its characters, and the historic moment when humanity made first contact with extraterrestrial intelligence.

Quick Facts

Release Year: ${movieData.year}

The eighth film in the Star Trek film series and the second featuring the cast of The Next Generation.

Directed by: Jonathan Frakes

This was Frakes' feature film directorial debut, also starring as Commander Riker.

Navigation

Use the navigation menu above to explore:

`); } function aboutPage() { return renderHTML('About', `

📽️ About the Movie

Plot Summary

${movieData.summary}

Historical Context

April 5, 2063

The date of humanity's first contact with alien life in the Star Trek timeline. After successfully testing the Phoenix, Earth's first warp-capable ship, Zefram Cochrane attracts the attention of a passing Vulcan survey ship, forever changing human history.

The Borg Threat

The Borg, a cybernetic collective consciousness, travel back in time to prevent this pivotal moment. Their goal: assimilate Earth before it can join the galactic community.

Themes

`); } function charactersPage() { const characterCards = movieData.characters.map(char => `

👤 ${char.name}

Played by: ${char.actor}

${char.role}

`).join(''); return renderHTML('Characters', `

🎭 Main Characters

Meet the heroes and villains of Star Trek: First Contact

${characterCards} `); } function notFoundPage() { return renderHTML('404 Not Found', `

⚠️ Page Not Found

The page you're looking for doesn't exist. Perhaps it was assimilated by the Borg?

Return to Home

`); } // Server const server = http.createServer((req, res) => { const parsedUrl = url.parse(req.url, true); const pathname = parsedUrl.pathname; let content; switch(pathname) { case '/': content = homePage(); break; case '/about': content = aboutPage(); break; case '/characters': content = charactersPage(); break; default: res.writeHead(404, { 'Content-Type': 'text/html' }); content = notFoundPage(); } res.writeHead(res.statusCode || 200, { 'Content-Type': 'text/html' }); res.end(content); }); server.listen(PORT, '0.0.0.0', () => { console.log(`🚀 Star Trek: First Contact server running on port ${PORT}`); console.log(`🖖 Live long and prosper!`); });