https://mywebsite.com/orders/1GETPOSTPUTPATCHDELETEhttps://mywebsite.com/ordersGET request return?
200 (OK)GET request return?
404 (Not Found)POST request return?
201 (Created)DELETE request return?
204 (No Content)RegEx with .test() to return a true or false evaluation of the presence of the pattern//let regex = /ox/;
let str = 'Fox jumps over the lazy dog';
let hasPattern = regex.test(str);
cosole.log(hasPattern); //returns `true`
.match() to extract the value that RegEx finds
REQUIRE
require('dotenv').config();
const express = require('express');
const cors = require('cors');
USE
app.use(cors());
const PORT = process.env.PORT || 3002;
ROUTES
app.get('/', (request, response)) => {
response.status(200).send('Server is running');
};
app.get('*', (request, response)) => {
res.status(404).send('404: File Not Found');
};
LISTEN
.env parameter in backend for weather API key WEATHER_API_KEY=<key><put-url-here> for reference${process.env.<api-key-var-name>}${searchVariable}axios to make the request from the backed using the request URL
async, await, and .data