Skip to content

Commit

Permalink
adds lecture content for class 09
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobKnaack committed Mar 7, 2024
1 parent d897225 commit 0138ea4
Show file tree
Hide file tree
Showing 29 changed files with 10,915 additions and 0 deletions.
4 changes: 4 additions & 0 deletions class-09/LECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Class 09 Lecture Notes

* [Whiteboard Link](https://projects.invisionapp.com/freehand/document/szMori7lJ)

49 changes: 49 additions & 0 deletions class-09/demo/city-explorer-server/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 8
},
"env": {
"es6": true,
"jest": true,
"node": true
},
"rules": {
"eol-last": "error",
"eqeqeq": [
"error",
"always"
],
"indent": [
"error",
2
],
"new-cap": "warn",
"no-console": "off",
"no-multi-spaces": [
"warn",
{
"exceptions": {
"VariableDeclarator": true
}
}
],
"no-redeclare": [
"error",
{
"builtinGlobals": true
}
],
"no-template-curly-in-string": "error",
"no-trailing-spaces": "warn",
"no-undefined": "off",
"quotes": [
"warn",
"single",
{
"allowTemplateLiterals": true
}
],
"semi": "error"
}
}
231 changes: 231 additions & 0 deletions class-09/demo/city-explorer-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@

# Created by https://www.gitignore.io/api/node,macos,linux,windows,webstorm,visualstudiocode

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### WebStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/

# MongoDB Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

### WebStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# Visual Studio 2015/2017 cache/options directory
.vs/


# End of https://www.gitignore.io/api/node,macos,linux,windows,webstorm,visualstudiocode
21 changes: 21 additions & 0 deletions class-09/demo/city-explorer-server/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Patrick Kawika Reveira

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 24 additions & 0 deletions class-09/demo/city-explorer-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# City Explorer Server #

**Author**: Patrick Kawika Reveira
**Version**: 1.0.0 (increment the patch/fix version number if you make more commits past your first submission)

## Overview
Creating a Weather search application.

![Request-Response Cycle](img/Lab-07-request-response-cycle.png)
![Functions Overview](img/lab-07%20functions%20overview.png)

## Getting Started
<!-- What are the steps that a user must take in order to build this app on their own machine and get it running? -->

## Architecture
<!-- Provide a detailed description of the application design. What technologies (languages, libraries, etc) you're using, and any other relevant design information. -->

## Change Log
<!-- Use this area to document the iterative changes made to your application as each feature is successfully implemented. Use time stamps. Here's an example:
01-01-2001 4:59pm - Application now has a fully-functional express server, with a GET route for the location resource. -->

## Credit and Collaborations
<!-- Give credit (and a link) to other people or resources that helped you build this application. -->
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions class-09/demo/city-explorer-server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

const express = require('express');
const cors = require('cors');
const app = express();
const dotenv = require('dotenv');

dotenv.config(); //loads our environment variables from our .env file

const { handleMovieRequest } = require('./lib/movies.js');
const { handleWeatherRequest } = require('./lib/weather.js');


const PORT = process.env.PORT;

app.use(cors());
app.use(express.json());

// read the params, call the getWeather
app.get('/weather/:lat_lon', handleWeatherRequest);
app.get('/movies/:city', handleMovieRequest);

app.listen(PORT, () => {
console.log('Server running on port 3000');
});
20 changes: 20 additions & 0 deletions class-09/demo/city-explorer-server/lib/movies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

const axios = require('axios');

const getMovies = async (city) => {
let movieResponse = await axios.get(`https://api.themoviedb.org/3/search/movie?query=${city}&api_key=dcb6acb50e45e4d4dfc8ed9f119c8abd`);
return movieResponse.data;
};

const handleMovieRequest = async (request, response) => {
const moviesData = await getMovies(request.params.city);
console.log(moviesData);
response.send(moviesData);
}

// export things to other files
module.exports = {
getMovies,
handleMovieRequest,
}
Loading

0 comments on commit 0138ea4

Please sign in to comment.