Question: Use an API Build a dynamic website using Node.js with Express.js and Pug.js. For this assignment, you must use the API from COLOURlovers (http://www.colourlovers.com/api) to

Use an API

Build a dynamic website using Node.js with Express.js and Pug.js. For this assignment, you must use the API from COLOURlovers (http://www.colourlovers.com/api) to fetch a random color every time your website is accessed. Then it must display that information based on my pug code:

doctype html

html

head

meta(http-equiv="Content-Type" content="text/html; charset=UTF-8")

title My Favorite Color Page!

style.

body {

background-color: #6BA0D7;

}

body

h1 The color of the day is watery!

div

span This color was created on 2017-03-01 12:45:03

div

a(href="http://www.colourlovers.com/api") Color by COLOURLover

You may add to this template, but you cannot remove information. In your version, the colors name, creation time, and the pages background-color will need to be pulled from the COLOURlovers random color API.

Here is my index.js:

"use strict";

const express = require("express"), app = express();

app.set("view engine", "pug");

app.set("views", "./views");

app.get("/", function (req, res) {

res.render("color");

});

app.listen(3000, function() {

console.log("The app listening on port 3000");

});

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!