-
Notifications
You must be signed in to change notification settings - Fork 0
Week 4 Homework - Super team picker #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
35f0171
bbb674c
96b12b8
78c892e
dca1e37
7f9964c
c1b4612
622341a
1a19f09
c86611d
d7d3257
a1cd0a6
4d9f133
095ac1b
bf028b8
fa3d37a
2cb5979
1dfc0a9
51e67b6
f9aa338
86046df
7428b6a
6e2f616
c3ce879
4c493a4
5aea536
401212e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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( | ||
| 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); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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}`) | ||
| }) | ||
| 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; |
| 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"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dataType It would be more appropriate for this to be a |
||
| table.text("name"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be more appropriate for this to be a |
||
| table.string("members"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| }) | ||
| }; | ||
|
|
||
| exports.down = function(knex) { | ||
| return knex.schema.dropTable('cohorts') | ||
| }; | ||
|
|
||
| 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' | ||
| } | ||
| } | ||
| }; |
There was a problem hiding this comment.
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
baseRouterthat is for aPATCHor aDELETEfor some reason, then currently they would NOT work.