Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
35f0171
Created todoCLI.js file
David-Ko Nov 24, 2018
bbb674c
added a barebone structure
David-Ko Nov 24, 2018
96b12b8
added comments to describe my proposed algorithm
David-Ko Nov 24, 2018
78c892e
added a callback function with several if-else statments
David-Ko Nov 24, 2018
dca1e37
modified code for non-stretch homework - code works
David-Ko Nov 26, 2018
7f9964c
created list.txt file
David-Ko Nov 26, 2018
c1b4612
created deleteItem() and completeItem()
David-Ko Nov 26, 2018
622341a
fixed the X of cX and dX issues
David-Ko Nov 26, 2018
1a19f09
cleaned up code for todoCLI.js
David-Ko Nov 30, 2018
c86611d
added a line regarding slice -- line 71
David-Ko Dec 2, 2018
d7d3257
created and downloaded packages for super_team_picker
David-Ko Dec 2, 2018
a1cd0a6
created routes and view folders and app.js and gitignore
David-Ko Dec 2, 2018
4d9f133
added home page AND created router
David-Ko Dec 2, 2018
095ac1b
committed DS_Store file
David-Ko Dec 3, 2018
bf028b8
transferred my work to here - homework version1
David-Ko Dec 7, 2018
fa3d37a
cleaned up my cohorts.js file
David-Ko Dec 7, 2018
2cb5979
explained the reason to have this file
David-Ko Dec 7, 2018
1dfc0a9
cleaned up app.js
David-Ko Dec 7, 2018
51e67b6
cleaned up edits.ejs file
David-Ko Dec 7, 2018
f9aa338
cleaned up homePage.ejs file
David-Ko Dec 7, 2018
86046df
cleaned up my index.ejs
David-Ko Dec 7, 2018
7428b6a
cleaned up my index.ejs again
David-Ko Dec 7, 2018
6e2f616
cleaned up new.ejs
David-Ko Dec 7, 2018
c3ce879
cleaned up new.ejs again
David-Ko Dec 7, 2018
4c493a4
partially cleaned up show.ejs file
David-Ko Dec 7, 2018
5aea536
cleaned up show.ejs file
David-Ko Dec 8, 2018
401212e
removed week3 work from branch
David-Ko Dec 8, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
128 changes: 128 additions & 0 deletions week4/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Created by https://www.gitignore.io/api/node,macos,linux
# Edit at https://www.gitignore.io/?templates=node,macos,linux

### 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 (https://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/

# FuseBox cache
.fusebox/

#DynamoDB Local files
.dynamodb/

# End of https://www.gitignore.io/api/node,macos,linux
28 changes: 28 additions & 0 deletions week4/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const express = require("express");
const app = express();
const logger = require("morgan");
app.use(logger("dev"));
app.set("view engine", "ejs");
app.use(express.urlencoded({ extended: true}))
const methodOverride = require("method-override")

const baseRouter = require("./routes/base.js")
app.use('/', baseRouter);

app.use(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better for all of your middlewares (like this one) to come before all of your routes. (like the one written on line 10).

Otherwise, if you had a route within the baseRouter that is for a PATCH or a DELETE for some reason, then currently they would NOT work.

methodOverride((req, res) => {
if (req.body && req.body._method) {
const method = req.body._method;
return method;
}
}),
);

const cohortsRouter = require("./routes/cohorts.js");
app.use('/cohorts', cohortsRouter);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


const PORT = 5002;
const HOST = "localhost";
app.listen(PORT, HOST, ()=>{
console.log(`Server is listening at port ${PORT} in host ${HOST}`)
})
5 changes: 5 additions & 0 deletions week4/db/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const knexfile = require("../knexfile");
const knexConnector = require("knex");
const knex = knexConnector(knexfile.development);

module.exports = knex;
15 changes: 15 additions & 0 deletions week4/db/migrations/20181202162622_cohorts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

exports.up = function(knex) {
return knex.schema.createTable('cohorts', table=>{
table.increments("id");
table.text("logoUrl");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dataType text is for long strings, like paragraphs, long lists.
Whereas the string type is for shorter strings (with a maximum length of 255 characters).

It would be more appropriate for this to be a string type.

table.text("name");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more appropriate for this to be a string type.

table.string("members");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this list could be very long, it would be more appropriate for this to be a text type.


})
};

exports.down = function(knex) {
return knex.schema.dropTable('cohorts')
};

19 changes: 19 additions & 0 deletions week4/knexfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Update with your config settings.

module.exports = {

development: {
client: 'pg',
connection: {
database: 'super_team_picker'
},

migrations: {
tableName: 'knex_migrations',
directory: './db/migrations'
},
seeds: {
directory: './db/seeds'
}
}
};
Loading