Skip to content

Instantly share code, notes, and snippets.

@Richardtex22
Richardtex22 / books.json
Last active July 16, 2024 10:06
A books array to mock data.
[
{
"id": "001",
"author": "Chinua Achebe",
"country": "Nigeria",
"imageLink": "https://unsplash.com/photos/9DaOYUYnOls",
"language": "English",
"link": "https://en.wikipedia.org/wiki/Things_Fall_Apart\n",
"pages": 209,
"title": "Things Fall Apart",
// A BASIC Node server listening for environment variables
const http = require("http");
const url = require("url");
const debug = require("debug")("app");
//listen for env variable NODE_ENV = development | production
const env = process.env.NODE_ENV ? process.env.NODE_ENV : "development";
const port = env === "development" ? 3000 : 5000;
const server = http.createServer(function(req, res) {
[
{
"Title": "Avatar",
"Year": "2009",
"Rated": "PG-13",
"Released": "18 Dec 2009",
"Runtime": "162 min",
"Genre": "Action, Adventure, Fantasy",
"Director": "James Cameron",
"Writer": "James Cameron",