942 views
5 votes
Task: Implement HTTP servers using the express framework. The main server should serve a single-page website to manage a collection of movies and actors. In more detail it should demonstrate the following technologies.

The main server (port 3000) serves static content such as css, scripts, and images using a dedicated route.
The initial single HTML page itself should be served using the Pug template engine.
The single page website should use the Fetch API to get information about movies and actors.
Information about movies and actors should be be accessible under an API route that uses pattern matching such as: movies/id007. 5. Images of movies and associated data should be stored in files (no database).
It should be possible to update comments and ratings of movies, which are managed by a dedicated, second API server (port 3001). The server may run in the same Node.js event loop.
Write a start script with starts both servers via npm start.

User Drake Guan
by
7.6k points

1 Answer

5 votes

Final answer:

To implement HTTP servers using the Express framework, follow the steps outlined here, including setting up the main server, using the Pug template engine, and utilizing the Fetch API for retrieving information about movies and actors.

Step-by-step explanation:

To implement HTTP servers using the express framework, you will need to follow these steps:

  1. Set up the main server (port 3000) to serve static content such as CSS, scripts, and images using a dedicated route.
  2. Use the Pug template engine to serve the initial single HTML page.
  3. Create a single-page website that uses the Fetch API to get information about movies and actors.
  4. Design an API route using pattern matching, such as 'movies/id007', to make information about movies and actors accessible.
  5. Store images of movies and associated data in files instead of a database.
  6. Implement a separate API server (port 3001) to handle the updating of comments and ratings for movies.
  7. Write a start script that starts both servers via npm start.

User Nachbar
by
8.0k points