diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..74e62fd59f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,22 @@ +module.exports = { + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended" + ], + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": 13, + "sourceType": "module" + }, + "plugins": [ + "react" + ], + "rules": { + } +}; diff --git a/.gitignore b/.gitignore index 09b3c36e30..01210427c5 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,121 @@ typings/ # databases *.db3 +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# 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 +*.lcov + +# 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/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* diff --git a/.history/README_20211029032535.md b/.history/README_20211029032535.md new file mode 100644 index 0000000000..6881baf133 --- /dev/null +++ b/.history/README_20211029032535.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [ ] Run `npm install` to install your dependencies. +- [ ] Run tests locally executing `npm test`. +- [ ] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [ ] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [ ] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [ ] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [ ] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [ ] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029032650.md b/.history/README_20211029032650.md new file mode 100644 index 0000000000..9996347461 --- /dev/null +++ b/.history/README_20211029032650.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x ] Run tests locally executing `npm test`. +- [ ] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [ ] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [ ] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [ ] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [ ] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [ ] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029032651.md b/.history/README_20211029032651.md new file mode 100644 index 0000000000..b791694408 --- /dev/null +++ b/.history/README_20211029032651.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [ ] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [ ] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [ ] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [ ] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [ ] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029032906.md b/.history/README_20211029032906.md new file mode 100644 index 0000000000..ddb2ba9021 --- /dev/null +++ b/.history/README_20211029032906.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x ] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [ ] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [ ] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [ ] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [ ] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029032908.md b/.history/README_20211029032908.md new file mode 100644 index 0000000000..369ad1f875 --- /dev/null +++ b/.history/README_20211029032908.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x ] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x ] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [ ] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [ ] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [ ] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029032909.md b/.history/README_20211029032909.md new file mode 100644 index 0000000000..23f09b8283 --- /dev/null +++ b/.history/README_20211029032909.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x ] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x ] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x ] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [ ] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [ ] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029032913.md b/.history/README_20211029032913.md new file mode 100644 index 0000000000..0d9a58c1c9 --- /dev/null +++ b/.history/README_20211029032913.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x ] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x ] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [ ] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [ ] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029032915.md b/.history/README_20211029032915.md new file mode 100644 index 0000000000..13a73418e8 --- /dev/null +++ b/.history/README_20211029032915.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [ ] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [ ] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029145940.md b/.history/README_20211029145940.md new file mode 100644 index 0000000000..391a47c7a2 --- /dev/null +++ b/.history/README_20211029145940.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [ ] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029145941.md b/.history/README_20211029145941.md new file mode 100644 index 0000000000..138df14f2e --- /dev/null +++ b/.history/README_20211029145941.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029145943.md b/.history/README_20211029145943.md new file mode 100644 index 0000000000..1329f4f35e --- /dev/null +++ b/.history/README_20211029145943.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029145945.md b/.history/README_20211029145945.md new file mode 100644 index 0000000000..333cc9c113 --- /dev/null +++ b/.history/README_20211029145945.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029145947.md b/.history/README_20211029145947.md new file mode 100644 index 0000000000..4bbb0894f9 --- /dev/null +++ b/.history/README_20211029145947.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [ ] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029145949.md b/.history/README_20211029145949.md new file mode 100644 index 0000000000..ad0b3102f4 --- /dev/null +++ b/.history/README_20211029145949.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [ ] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029145951.md b/.history/README_20211029145951.md new file mode 100644 index 0000000000..fcbbad3d67 --- /dev/null +++ b/.history/README_20211029145951.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [x] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [ ] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029145953.md b/.history/README_20211029145953.md new file mode 100644 index 0000000000..5ae63773c9 --- /dev/null +++ b/.history/README_20211029145953.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [x] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [x] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [ ] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029145954.md b/.history/README_20211029145954.md new file mode 100644 index 0000000000..daafc7e7e8 --- /dev/null +++ b/.history/README_20211029145954.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [x] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [x] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [x] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [ ] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029145956.md b/.history/README_20211029145956.md new file mode 100644 index 0000000000..28341c1609 --- /dev/null +++ b/.history/README_20211029145956.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [x] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [x] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [x] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [x] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [ ] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029150001.md b/.history/README_20211029150001.md new file mode 100644 index 0000000000..59a31b93d0 --- /dev/null +++ b/.history/README_20211029150001.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [x] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [x] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [x] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [x] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029150007.md b/.history/README_20211029150007.md new file mode 100644 index 0000000000..35de91623d --- /dev/null +++ b/.history/README_20211029150007.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [x] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [x] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [x] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [x] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [x] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029150026.md b/.history/README_20211029150026.md new file mode 100644 index 0000000000..898be417cd --- /dev/null +++ b/.history/README_20211029150026.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [x] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [x] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [x] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [x] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [x] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [ ] Submit via Codegrade by pushing commits to your `main` branch. +- [ ] Check Codegrade before the deadline to compare its results against your local tests. +- [x] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029150029.md b/.history/README_20211029150029.md new file mode 100644 index 0000000000..92a88a576e --- /dev/null +++ b/.history/README_20211029150029.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [x] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [x] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [x] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [x] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [x] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [x] Submit via Codegrade by pushing commits to your `main` branch. +- [x] Check Codegrade before the deadline to compare its results against your local tests. +- [x] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/.history/README_20211029150031.md b/.history/README_20211029150031.md new file mode 100644 index 0000000000..547ad3dc1c --- /dev/null +++ b/.history/README_20211029150031.md @@ -0,0 +1,153 @@ +# Sprint Challenge Instructions + +**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.** + +This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **how to build web services based on the REST (REpresentational State Transfer) architectural style**. During this sprint, you studied **Node.js and Express, server side routing, how to write Express middleware and how to deploy an API to Heroku**. + +In your challenge this week, you will demonstrate your mastery of these skills by designing and creating a web API to manage the following resources: `Projects` and `Actions`. + +This is an individual assessment. All work must be your own. All projects will be submitted to Codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a). + +You are not allowed to collaborate during the sprint challenge. + +## Introduction + +In meeting the minimum viable product (MVP) specifications listed below, your project should provide an API that has Create, Read, Update and Delete (CRUD) functionality for both `projects` and `actions`. + +## Instructions + +### Task 1: Project Set Up + +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. + +### Task 2: Project Requirements (MVP) + +Your finished project must include all of the following requirements: + +#### NPM Scripts + +A _"test"_ script already exists you can use to run tests against your code. +A _"resetdb"_ script exists that allows you to reset the database to its original state. + +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. + +#### Environment Variables + +- [ ] Bring the port number from the `process.env` variable, falling back to `5000` if `process.env.PORT` is undefined **!!!** + +#### Endpoints + +Inside `api/projects/projects-router.js` build the following endpoints: + +- [x] `[GET] /api/projects` + - Returns an array of projects as the body of the response. + - If there are no projects it responds with an empty array. +- [x] `[GET] /api/projects/:id` + - Returns a project with the given `id` as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[POST] /api/projects` + - Returns the newly created project as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[PUT] /api/projects/:id` + - Returns the updated project as the body of the response. + - If there is no project with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/projects/:id` + - Returns no response body. + - If there is no project with the given `id` it responds with a status code 404. +- [x] `[GET] /api/projects/:id/actions` + - Returns an array of actions (could be empty) belonging to a project with the given `id`. + - If there is no project with the given `id` it responds with a status code 404. + +Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: + +- [x] `[GET] /api/actions` + - Returns an array of actions (or an empty array) as the body of the response. +- [x] `[GET] /api/actions/:id` + - Returns an action with the given `id` as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. +- [x] `[POST] /api/actions` + - Returns the newly created action as the body of the response. + - If the request body is missing any of the required fields it responds with a status code 400. + - When adding an action make sure the `project_id` provided belongs to an existing `project`. +- [x] `[PUT] /api/actions/:id` + - Returns the updated action as the body of the response. + - If there is no action with the given `id` it responds with a status code 404. + - If the request body is missing any of the required fields it responds with a status code 400. +- [x] `[DELETE] /api/actions/:id` + - Returns no response body. + - If there is no action with the given `id` it responds with a status code 404. + +#### Middleware functions + +- [x] Write at least two middleware functions for this API, and consume them in the proper places of your code. + +### Database Schemas + +The description of the structure and extra information about each _resource_ stored in the included database (`./data/database.db3`) is listed below. + +#### Projects + +| Field | Data Type | Metadata | +| ----------- | --------- | --------------------------------------------------------------------------- | +| id | number | do not provide it when creating projects, the database will generate it | +| name | string | required | +| description | string | required | +| completed | boolean | not required, defaults to false when creating projects | + +#### Actions + +| Field | Data Type | Metadata | +| ----------- | --------- | ------------------------------------------------------------------------------------------------ | +| id | number | do not provide it when creating actions, the database will generate it | +| project_id | number | required, must be the id of an existing project | +| description | string | required, up to 128 characters long | +| notes | string | required, no size limit. Used to record additional notes or requirements to complete the action | +| completed | boolean | not required, defaults to false when creating actions | + +### Database Persistence Helpers + +The project includes models you can use to manage the persistence of _project_ and _action_ data. These files are `api/projects/projects-model.js` and `api/actions/actions-model.js`. Both files publish the following api, which you can use to store, modify and retrieve each resource: + +**All these helper methods return a promise. Remember to use .then().catch() or async/await.** + +- `get()`: resolves to an array of all the resources contained in the database. If you pass an `id` to this method it will return the resource with that id if one is found. +- `insert()`: calling insert passing it a resource object will add it to the database and return the newly created resource. +- `update()`: accepts two arguments, the first is the `id` of the resource to update, and the second is an object with the `changes` to apply. It returns the updated resource. If a resource with the provided `id` is not found, the method returns `null`. +- `remove()`: the remove method accepts an `id` as its first parameter and, upon successfully deleting the resource from the database, returns the number of records deleted. + +The `projects-model.js` includes an extra method called `getProjectActions()` that takes a _project id_ as its only argument and returns a list of all the _actions_ for the _project_. + +We have provided test data for all the resources. + +**Important Notes:** + +- Do not make changes to your `package.json` except to add **additional** dependencies and scripts. Do not update existing packages. +- Your app must be able to run in Node v.12. Do not use newer features of Node (e.g.: optional chaining and nullish coalescing NOT supported). +- Use an HTTP client like `HTTPie`, `Postman` or `Insomnia` to manually test the API's endpoints. +- Use Express Routers to organize your endpoints. +- Even though you are only required to write two middleware functions, it is advised that you leverage middlewares as much as possible. +- You are welcome to create additional files, but **do not move or rename existing files** or folders. +- In your solution, it is essential that you follow best practices and produce clean and professional results. +- Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. + +## Submission format + +- [x] Submit via Codegrade by pushing commits to your `main` branch. +- [x] Check Codegrade before the deadline to compare its results against your local tests. +- [x] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [x] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. + +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. diff --git a/README.md b/README.md index 6881baf133..547ad3dc1c 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ In meeting the minimum viable product (MVP) specifications listed below, your pr ### Task 1: Project Set Up -- [ ] Run `npm install` to install your dependencies. -- [ ] Run tests locally executing `npm test`. -- [ ] Reset the database to its original state executing `npm run resetdb`. +- [x] Run `npm install` to install your dependencies. +- [x] Run tests locally executing `npm test`. +- [x] Reset the database to its original state executing `npm run resetdb`. ### Task 2: Project Requirements (MVP) @@ -31,9 +31,9 @@ Your finished project must include all of the following requirements: A _"test"_ script already exists you can use to run tests against your code. A _"resetdb"_ script exists that allows you to reset the database to its original state. -- [ ] Write an _npm script_ named _"start"_ that uses `node` to run the API server. -- [ ] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. -- [ ] Install _nodemon_ as a development dependency that would not be used in production. +- [x] Write an _npm script_ named _"start"_ that uses `node` to run the API server. +- [x] Write an _npm script_ named _"server"_ that uses `nodemon` to run the API server. +- [x] Install _nodemon_ as a development dependency that would not be used in production. #### Environment Variables @@ -43,48 +43,48 @@ A _"resetdb"_ script exists that allows you to reset the database to its origina Inside `api/projects/projects-router.js` build the following endpoints: -- [ ] `[GET] /api/projects` +- [x] `[GET] /api/projects` - Returns an array of projects as the body of the response. - If there are no projects it responds with an empty array. -- [ ] `[GET] /api/projects/:id` +- [x] `[GET] /api/projects/:id` - Returns a project with the given `id` as the body of the response. - If there is no project with the given `id` it responds with a status code 404. -- [ ] `[POST] /api/projects` +- [x] `[POST] /api/projects` - Returns the newly created project as the body of the response. - If the request body is missing any of the required fields it responds with a status code 400. -- [ ] `[PUT] /api/projects/:id` +- [x] `[PUT] /api/projects/:id` - Returns the updated project as the body of the response. - If there is no project with the given `id` it responds with a status code 404. - If the request body is missing any of the required fields it responds with a status code 400. -- [ ] `[DELETE] /api/projects/:id` +- [x] `[DELETE] /api/projects/:id` - Returns no response body. - If there is no project with the given `id` it responds with a status code 404. -- [ ] `[GET] /api/projects/:id/actions` +- [x] `[GET] /api/projects/:id/actions` - Returns an array of actions (could be empty) belonging to a project with the given `id`. - If there is no project with the given `id` it responds with a status code 404. Inside `api/actions/actions-router.js` build endpoints for performing CRUD operations on _actions_: -- [ ] `[GET] /api/actions` +- [x] `[GET] /api/actions` - Returns an array of actions (or an empty array) as the body of the response. -- [ ] `[GET] /api/actions/:id` +- [x] `[GET] /api/actions/:id` - Returns an action with the given `id` as the body of the response. - If there is no action with the given `id` it responds with a status code 404. -- [ ] `[POST] /api/actions` +- [x] `[POST] /api/actions` - Returns the newly created action as the body of the response. - If the request body is missing any of the required fields it responds with a status code 400. - When adding an action make sure the `project_id` provided belongs to an existing `project`. -- [ ] `[PUT] /api/actions/:id` +- [x] `[PUT] /api/actions/:id` - Returns the updated action as the body of the response. - If there is no action with the given `id` it responds with a status code 404. - If the request body is missing any of the required fields it responds with a status code 400. -- [ ] `[DELETE] /api/actions/:id` +- [x] `[DELETE] /api/actions/:id` - Returns no response body. - If there is no action with the given `id` it responds with a status code 404. #### Middleware functions -- [ ] Write at least two middleware functions for this API, and consume them in the proper places of your code. +- [x] Write at least two middleware functions for this API, and consume them in the proper places of your code. ### Database Schemas @@ -137,10 +137,10 @@ We have provided test data for all the resources. ## Submission format -- [ ] Submit via Codegrade by pushing commits to your `main` branch. -- [ ] Check Codegrade before the deadline to compare its results against your local tests. -- [ ] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. -- [ ] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. +- [x] Submit via Codegrade by pushing commits to your `main` branch. +- [x] Check Codegrade before the deadline to compare its results against your local tests. +- [x] Check Codegrade on the days following the Sprint Challenge for reviewer feedback. +- [x] New commits will be evaluated by Codegrade if pushed _before_ the sprint challenge deadline. ## Interview Questions diff --git a/api/actions/actions-middlware.js b/api/actions/actions-middlware.js index 83749a06eb..e75fd40003 100644 --- a/api/actions/actions-middlware.js +++ b/api/actions/actions-middlware.js @@ -1 +1,53 @@ -// add middlewares here related to actions +const Action = require("./actions-model"); +const Project = require("../projects/projects-model"); + +async function validateId(req, res, next) { + const { id } = req.params; + const action = await Action.get(id); + if (!action) { + res.status(404).json({ + message: `${id} not found`, + }); + } else { + req.action = action; + next(); + } +} + +async function validateNewAction(req, res, next) { + const { project_id, description, notes, completed } = req.body; + + if ( + !project_id || + typeof project_id !== "number" || + !description || + description.trim() === "" || + !notes || + notes.trim() === "" + ) { + res.status(400).json({ + message: "missing required field, project_id, description, or notes", + }); + } else { + req.newAction = { project_id, description, notes, completed }; + next(); + } +} + +async function validateProject(req, res, next) { + const { project_id } = req.body; + const project = await Project.get(project_id); + if (!project) { + res.status(404).json({ + message: "project_id not found", + }); + } else { + next(); + } +} + +module.exports = { + validateId, + validateNewAction, + validateProject, +}; diff --git a/api/actions/actions-model.js b/api/actions/actions-model.js index dcddde3d10..36000c3cf4 100644 --- a/api/actions/actions-model.js +++ b/api/actions/actions-model.js @@ -1,7 +1,6 @@ // DO NOT MAKE CHANGES TO THIS FILE -const db = require('../../data/dbConfig.js'); -const mappers = require('../../data/helpers/mappers'); - +const db = require("../../data/dbConfig.js"); +const mappers = require("../../data/helpers/mappers"); module.exports = { get, insert, @@ -10,11 +9,11 @@ module.exports = { }; function get(id) { - let query = db('actions'); + let query = db("actions"); if (id) { return query - .where('id', id) + .where("id", id) .first() .then((action) => { if (action) { @@ -31,18 +30,18 @@ function get(id) { } function insert(action) { - return db('actions') + return db("actions") .insert(action) .then(([id]) => get(id)); } function update(id, changes) { - return db('actions') - .where('id', id) + return db("actions") + .where("id", id) .update(changes) .then((count) => (count > 0 ? get(id) : null)); } function remove(id) { - return db('actions').where('id', id).del(); + return db("actions").where("id", id).del(); } diff --git a/api/actions/actions-router.js b/api/actions/actions-router.js index 84cca1b38f..ef9cc7e98b 100644 --- a/api/actions/actions-router.js +++ b/api/actions/actions-router.js @@ -1 +1,73 @@ -// Write your "actions" router here! +const express = require("express"); +const Action = require("./actions-model"); +const { + validateId, + validateNewAction, + validateProject, +} = require("./actions-middlware"); +const router = express.Router(); + +router.get("/", async (req, res, next) => { + try { + const actions = await Action.get(); + res.status(200).json([...actions]); + } catch (err) { + next(err); + } +}); + +router.get("/:id", validateId, async (req, res, next) => { + try { + res.status(200).json({ ...req.action }); + } catch (err) { + next(err); + } +}); + +router.post( + "/", + validateId, + validateNewAction, + validateProject, + async (req, res, next) => { + try { + const newAction = await Action.insert(req.newAction); + res.status(201).json({ ...newAction }); + } catch (err) { + next(err); + } + } +); + +router.put( + "/:id", + validateId, + validateNewAction, + validateProject, + async (req, res, next) => { + try { + const newAction = await Action.update(req.params.id, req.newAction); + res.status(201).json({ ...newAction }); + } catch (err) { + next(err); + } + } +); + +router.delete("/:id", validateId, async (req, res, next) => { + try { + const numberOfDeletedItem = await Action.remove(req.params.id); + res.status(201).json(`deleted ${numberOfDeletedItem} action`); + } catch (err) { + next(err); + } +}); + +router.use((err, req, res, next) => { + res.status(err.status || 500).json({ + custMessage: "Error Occured retrieving /api/actions path", + message: err.message, + }); +}); + +module.exports = router; diff --git a/api/projects/projects-middleware.js b/api/projects/projects-middleware.js index 71cac557e5..86c21ecc95 100644 --- a/api/projects/projects-middleware.js +++ b/api/projects/projects-middleware.js @@ -1 +1,51 @@ -// add middlewares here related to projects +const Project = require("./projects-model"); + +async function validateProjectId(req, res, next) { + const { id } = req.params; + const project = await Project.get(id); + if (!project) { + res.status(404).json({ + message: `project ${id} not found`, + }); + } else { + req.project = project; + next(); + } +} + +function validateNewProject(req, res, next) { + const { name, description, completed } = req.body; + if (!name || name === "" || !description || description === "") { + res + .status(400) + .json({ message: "missing required fields : name, description" }); + } else { + req.newProject = { name, description, completed }; + next(); + } +} + +function validateExistingProject(req, res, next) { + //{name:___, description:____, completed:____} + const { name, description, completed } = req.body; + if ( + !name || + name === "" || + !description || + description === "" + // || !completed + ) { + res.status(400).json({ + message: "missing required fields : name, description, completed", + }); + } else { + req.existingProject = { name, description, completed }; + next(); + } +} + +module.exports = { + validateProjectId, + validateNewProject, + validateExistingProject, +}; diff --git a/api/projects/projects-model.js b/api/projects/projects-model.js index e641c92ec3..0ac03b6c77 100644 --- a/api/projects/projects-model.js +++ b/api/projects/projects-model.js @@ -1,5 +1,5 @@ // DO NOT MAKE CHANGES TO THIS FILE -const db = require("../../data/dbConfig.js"); +const Project = require("../../data/dbConfig.js"); const mappers = require('../../data/helpers/mappers'); module.exports = { @@ -11,7 +11,7 @@ module.exports = { }; function get(id) { - let query = db("projects as p"); + let query = Project("projects as p"); if (id) { query.where("p.id", id).first(); @@ -37,26 +37,26 @@ function get(id) { } function insert(project) { - return db("projects") + return Project("projects") .insert(project) .then(([id]) => get(id)); } function update(id, changes) { - return db("projects") + return Project("projects") .where("id", id) .update(changes) .then(count => (count > 0 ? get(id) : null)); } function remove(id) { - return db("projects") + return Project("projects") .where("id", id) .del(); } function getProjectActions(projectId) { - return db("actions") + return Project("actions") .where("project_id", projectId) .then(actions => actions.map(action => mappers.actionToBody(action))); } diff --git a/api/projects/projects-router.js b/api/projects/projects-router.js index b83038115d..45651f526c 100644 --- a/api/projects/projects-router.js +++ b/api/projects/projects-router.js @@ -1 +1,78 @@ -// Write your "projects" router here! +const express = require("express"); +const Project = require("./projects-model"); +const { + validateProjectId, + validateNewProject, + validateExistingProject, +} = require("./projects-middleware"); +const router = express.Router(); + +router.get("/", async (req, res, next) => { + try { + const projects = await Project.get(); + res.status(200).json(projects ? [...projects] : []); + } catch (err) { + next(err); + } +}); + +router.get("/:id", validateProjectId, async (req, res, next) => { + try { + res.status(200).json({ ...req.project }); + } catch (err) { + next(err); + } +}); + +router.post("/", validateNewProject, async (req, res, next) => { + try { + const newProject = await Project.insert(req.newProject); + res.status(201).json({ ...newProject }); + } catch (err) { + next(err); + } +}); + +router.put( + "/:id", + validateProjectId, + validateExistingProject, + async (req, res, next) => { + try { + const updatedProject = await Project.update( + req.params.id, + req.existingProject + ); + res.status(201).json({ ...updatedProject }); + } catch (err) { + next(err); + } + } +); + +router.delete("/:id", validateProjectId, async (req, res, next) => { + try { + const deletedProject = await Project.remove(req.params.id); + res.status(201).json({ ...deletedProject }); + } catch (err) { + next(err); + } +}); + +router.get("/:id/actions", validateProjectId, async (req, res, next) => { + try { + const actions = await Project.getProjectActions(req.params.id); + res.status(200).json(actions.length === 0 ? [] : [...actions]); + } catch (err) { + next(err); + } +}); + +router.use((err, req, res, next) => { + res.status(err.status || 500).json({ + custMessage: "Error Occured retrieving /api/actions path", + message: err.message, + }); +}); + +module.exports = router; diff --git a/api/server.js b/api/server.js index bbee0934a2..e9c9ac698d 100644 --- a/api/server.js +++ b/api/server.js @@ -1,9 +1,13 @@ -const express = require('express'); +const express = require("express"); +const routerAction = require("./actions/actions-router"); +const routerProject = require("./projects/projects-router"); const server = express(); +server.use(express.json()); -// Configure your server here -// Build your actions router in /api/actions/actions-router.js -// Build your projects router in /api/projects/projects-router.js -// Do NOT `server.listen()` inside this file! +server.get("/", (req, res) => { + res.status(200).json({ message: "Hello world" }); +}); +server.use("/api/actions", routerAction); +server.use("/api/projects", routerProject); module.exports = server; diff --git a/index.js b/index.js index 4cf807118d..ccdc47a593 100644 --- a/index.js +++ b/index.js @@ -1,14 +1,8 @@ -/* -play this: https://www.youtube.com/watch?v=d-diB65scQU +require("dotenv").config(); +const server = require("./api/server"); +const PORT = process.env.PORT || 5000; -Sing along: - -here's a little code I wrote, please read the README word for word, don't worry, you got this -in every task there may be trouble, but if you worry you make it double, don't worry, you got this -ain't got no sense of what is REST? just concentrate on learning Express, don't worry, you got this -your file is getting way too big, bring a Router and make it thin, don't worry, be crafty -there is no data on that route, just write some code, you'll sort it out… don't worry, just hack it… -I need this code, but don't know where, perhaps should make some middleware, don't worry, just hack it - -Pull your server into this file and start it! -*/ +server.listen(PORT, () => { + console.log("======================================"); + console.log(`listening on port ${PORT}`); +}); diff --git a/interview.md b/interview.md new file mode 100644 index 0000000000..8cc7b042f1 --- /dev/null +++ b/interview.md @@ -0,0 +1,9 @@ +## Interview Questions + +Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. You might prepare by writing down your own answers before hand. + +1. The core features of Node.js and Express and why they are useful. +1. Understand and explain the use of Middleware. +1. The basic principles of the REST architectural style. +1. Understand and explain the use of Express Routers. +1. Describe tooling used to manually test the correctness of an API. \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 855865eefd..c229f055cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,9 @@ "version": "0.0.1", "license": "ISC", "dependencies": { - "express": "4.17.1", + "cors": "^2.8.5", + "dotenv": "^10.0.0", + "express": "^4.17.1", "helmet": "4.6.0", "knex": "0.95.11", "sqlite3": "5.0.2" @@ -19,6 +21,7 @@ "eslint": "8.0.1", "jest": "27.3.1", "knex-cleaner": "1.3.1", + "nodemon": "^2.0.14", "supertest": "6.1.6" } }, @@ -993,6 +996,15 @@ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, + "node_modules/@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/@sinonjs/commons": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", @@ -1011,6 +1023,18 @@ "@sinonjs/commons": "^1.7.0" } }, + "node_modules/@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "dependencies": { + "defer-to-connect": "^1.0.1" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -1230,6 +1254,38 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-align/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -1498,6 +1554,15 @@ "tweetnacl": "^0.14.3" } }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/block-stream": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", @@ -1549,6 +1614,63 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "node_modules/boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1622,6 +1744,48 @@ "node": ">= 0.8" } }, + "node_modules/cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cacheable-request/node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -1694,6 +1858,39 @@ "node": ">=10" } }, + "node_modules/chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", @@ -1711,6 +1908,18 @@ "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", "dev": true }, + "node_modules/cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -1745,6 +1954,15 @@ "node": ">=8" } }, + "node_modules/clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + } + }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -1818,6 +2036,23 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, + "node_modules/configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "dependencies": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", @@ -1875,6 +2110,18 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -1907,6 +2154,15 @@ "node": ">= 8" } }, + "node_modules/crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", @@ -1979,6 +2235,18 @@ "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==", "dev": true }, + "node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -2008,6 +2276,12 @@ "node": ">=0.10.0" } }, + "node_modules/defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -2097,6 +2371,32 @@ "node": ">=8" } }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -2144,6 +2444,15 @@ "node": ">= 0.8" } }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -2164,6 +2473,15 @@ "node": ">=6" } }, + "node_modules/escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -2936,6 +3254,30 @@ "node": ">=10.13.0" } }, + "node_modules/global-dirs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dev": true, + "dependencies": { + "ini": "2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/global-dirs/node_modules/ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/globals": { "version": "13.11.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", @@ -2951,6 +3293,40 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/got/node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", @@ -3017,6 +3393,15 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, + "node_modules/has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/helmet": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/helmet/-/helmet-4.6.0.tgz", @@ -3043,6 +3428,12 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "node_modules/http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, "node_modules/http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", @@ -3129,6 +3520,12 @@ "node": ">= 4" } }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true + }, "node_modules/ignore-walk": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz", @@ -3153,6 +3550,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/import-local": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.3.tgz", @@ -3213,6 +3619,36 @@ "node": ">= 0.10" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "dependencies": { + "ci-info": "^2.0.0" + }, + "bin": { + "is-ci": "bin.js" + } + }, + "node_modules/is-ci/node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, "node_modules/is-core-module": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", @@ -3265,6 +3701,34 @@ "node": ">=0.10.0" } }, + "node_modules/is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dev": true, + "dependencies": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -3274,6 +3738,24 @@ "node": ">=0.12.0" } }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", @@ -3298,6 +3780,12 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "devOptional": true }, + "node_modules/is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -4089,6 +4577,12 @@ "node": ">=4" } }, + "node_modules/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, "node_modules/json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -4143,6 +4637,15 @@ "verror": "1.10.0" } }, + "node_modules/keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.0" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -4218,6 +4721,18 @@ "node": ">=8" } }, + "node_modules/latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "dependencies": { + "package-json": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -4263,6 +4778,15 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -4387,6 +4911,15 @@ "node": ">=6" } }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -4638,6 +5171,74 @@ "integrity": "sha512-aA87l0flFYMzCHpTM3DERFSYxc6lv/BltdbRTOMZuxZ0cwZCD3mejE5n9vLhSJCN++/eOqr77G1IO5uXxlQYWA==", "dev": true }, + "node_modules/nodemon": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.14.tgz", + "integrity": "sha512-frcpDx+PviKEQRSYzwhckuO2zoHcBYLHI754RE9z5h1RGtrngerc04mLpQQCPWBkH/2ObrX7We9YiwVSYZpFJQ==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "chokidar": "^3.2.2", + "debug": "^3.2.6", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.7", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.3", + "update-notifier": "^5.1.0" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/nodemon/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/nodemon/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/nodemon/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -4659,6 +5260,15 @@ "node": ">=0.10.0" } }, + "node_modules/normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/npm-bundled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", @@ -4821,6 +5431,15 @@ "os-tmpdir": "^1.0.0" } }, + "node_modules/p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -4857,6 +5476,30 @@ "node": ">=6" } }, + "node_modules/package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "dependencies": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -4981,6 +5624,15 @@ "node": ">= 0.8.0" } }, + "node_modules/prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/pretty-format": { "version": "27.3.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.3.1.tgz", @@ -5053,13 +5705,41 @@ "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", "devOptional": true }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "devOptional": true, "engines": { - "node": ">=6" + "node": ">=6" + } + }, + "node_modules/pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "dependencies": { + "escape-goat": "^2.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/qs": { @@ -5134,6 +5814,18 @@ "util-deprecate": "~1.0.1" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/rechoir": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.0.tgz", @@ -5157,6 +5849,30 @@ "url": "https://github.com/sponsors/mysticatea" } }, + "node_modules/registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dev": true, + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -5295,6 +6011,15 @@ "node": ">=10" } }, + "node_modules/responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "dependencies": { + "lowercase-keys": "^1.0.0" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -5352,6 +6077,27 @@ "node": ">=10" } }, + "node_modules/semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "dependencies": { + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/semver-diff/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/send": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", @@ -5858,6 +6604,15 @@ "node": ">=4" } }, + "node_modules/to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -5878,6 +6633,33 @@ "node": ">=0.6" } }, + "node_modules/touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "dependencies": { + "nopt": "~1.0.10" + }, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/touch/node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" + } + }, "node_modules/tough-cookie": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", @@ -5976,6 +6758,24 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "node_modules/unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -5993,6 +6793,34 @@ "node": ">= 0.8" } }, + "node_modules/update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dev": true, + "dependencies": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/yeoman/update-notifier?sponsor=1" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -6002,6 +6830,18 @@ "punycode": "^2.1.0" } }, + "node_modules/url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "dependencies": { + "prepend-http": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -6157,6 +6997,41 @@ "string-width": "^1.0.2 || 2" } }, + "node_modules/widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -6244,6 +7119,15 @@ } } }, + "node_modules/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", @@ -7081,6 +7965,12 @@ "chalk": "^4.0.0" } }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true + }, "@sinonjs/commons": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", @@ -7099,6 +7989,15 @@ "@sinonjs/commons": "^1.7.0" } }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "requires": { + "defer-to-connect": "^1.0.1" + } + }, "@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -7290,6 +8189,34 @@ "uri-js": "^4.2.2" } }, + "ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "requires": { + "string-width": "^4.1.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -7502,6 +8429,12 @@ "tweetnacl": "^0.14.3" } }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, "block-stream": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", @@ -7549,6 +8482,47 @@ } } }, + "boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "requires": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -7606,6 +8580,38 @@ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + } + } + }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -7656,6 +8662,33 @@ "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", "dev": true }, + "chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, "chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", @@ -7673,6 +8706,12 @@ "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", "dev": true }, + "cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true + }, "cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -7703,6 +8742,15 @@ } } }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -7760,6 +8808,20 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, + "configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "requires": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + } + }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", @@ -7808,6 +8870,15 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, "cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -7828,6 +8899,12 @@ "which": "^2.0.1" } }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true + }, "cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", @@ -7885,6 +8962,15 @@ "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==", "dev": true }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, "dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -7908,6 +8994,12 @@ "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", "dev": true }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -7972,6 +9064,26 @@ } } }, + "dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "requires": { + "is-obj": "^2.0.0" + } + }, + "dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -8010,6 +9122,15 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, "enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -8024,6 +9145,12 @@ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" }, + "escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -8628,6 +9755,23 @@ "is-glob": "^4.0.3" } }, + "global-dirs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dev": true, + "requires": { + "ini": "2.0.0" + }, + "dependencies": { + "ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "dev": true + } + } + }, "globals": { "version": "13.11.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", @@ -8637,6 +9781,36 @@ "type-fest": "^0.20.2" } }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, + "dependencies": { + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + } + } + }, "graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", @@ -8684,6 +9858,12 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, + "has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true + }, "helmet": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/helmet/-/helmet-4.6.0.tgz", @@ -8704,6 +9884,12 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, "http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", @@ -8768,6 +9954,12 @@ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true + }, "ignore-walk": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz", @@ -8786,6 +9978,12 @@ "resolve-from": "^4.0.0" } }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, "import-local": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.3.tgz", @@ -8831,6 +10029,32 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + }, + "dependencies": { + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + } + } + }, "is-core-module": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", @@ -8868,12 +10092,40 @@ "is-extglob": "^2.1.1" } }, + "is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dev": true, + "requires": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + } + }, + "is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "dev": true + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, "is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", @@ -8892,6 +10144,12 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "devOptional": true }, + "is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -9513,6 +10771,12 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -9558,6 +10822,15 @@ "verror": "1.10.0" } }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, "kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -9606,6 +10879,15 @@ "lodash": "^4.17.13" } }, + "latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "requires": { + "package-json": "^6.3.0" + } + }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -9642,6 +10924,12 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -9732,6 +11020,12 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -9942,6 +11236,56 @@ "integrity": "sha512-aA87l0flFYMzCHpTM3DERFSYxc6lv/BltdbRTOMZuxZ0cwZCD3mejE5n9vLhSJCN++/eOqr77G1IO5uXxlQYWA==", "dev": true }, + "nodemon": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.14.tgz", + "integrity": "sha512-frcpDx+PviKEQRSYzwhckuO2zoHcBYLHI754RE9z5h1RGtrngerc04mLpQQCPWBkH/2ObrX7We9YiwVSYZpFJQ==", + "dev": true, + "requires": { + "chokidar": "^3.2.2", + "debug": "^3.2.6", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.7", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.3", + "update-notifier": "^5.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -9957,6 +11301,12 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "dev": true + }, "npm-bundled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", @@ -10086,6 +11436,12 @@ "os-tmpdir": "^1.0.0" } }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true + }, "p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -10110,6 +11466,26 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "requires": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -10204,6 +11580,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, "pretty-format": { "version": "27.3.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.3.1.tgz", @@ -10260,12 +11642,37 @@ "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", "devOptional": true }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "devOptional": true }, + "pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "requires": { + "escape-goat": "^2.0.0" + } + }, "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", @@ -10325,6 +11732,15 @@ "util-deprecate": "~1.0.1" } }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, "rechoir": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.0.tgz", @@ -10339,6 +11755,24 @@ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, + "registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -10446,6 +11880,15 @@ "integrity": "sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ==", "dev": true }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -10488,6 +11931,23 @@ "lru-cache": "^6.0.0" } }, + "semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "send": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", @@ -10883,6 +12343,12 @@ "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "dev": true }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -10897,6 +12363,26 @@ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "requires": { + "nopt": "~1.0.10" + }, + "dependencies": { + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "requires": { + "abbrev": "1" + } + } + } + }, "tough-cookie": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", @@ -10971,6 +12457,21 @@ "is-typedarray": "^1.0.0" } }, + "undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "requires": { + "crypto-random-string": "^2.0.0" + } + }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -10982,6 +12483,28 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, + "update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dev": true, + "requires": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + } + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -10991,6 +12514,15 @@ "punycode": "^2.1.0" } }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "requires": { + "prepend-http": "^2.0.0" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -11118,6 +12650,34 @@ "string-width": "^1.0.2 || 2" } }, + "widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "requires": { + "string-width": "^4.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -11178,6 +12738,12 @@ "dev": true, "requires": {} }, + "xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true + }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", diff --git a/package.json b/package.json index 5d7ebecc16..5deaf6f23f 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,8 @@ "version": "0.0.1", "main": "index.js", "scripts": { + "start": "node index.js", + "server": "nodemon index.js", "test": "cross-env NODE_ENV=testing jest --watchAll --verbose --runInBand --silent", "resetdb": "knex migrate:rollback && knex migrate:latest && knex seed:run" }, @@ -11,7 +13,9 @@ "url": "git+https://github.com/LambdaSchool/web-sprint-challenge-build-a-web-api" }, "dependencies": { - "express": "4.17.1", + "cors": "^2.8.5", + "dotenv": "^10.0.0", + "express": "^4.17.1", "helmet": "4.6.0", "knex": "0.95.11", "sqlite3": "5.0.2" @@ -21,6 +25,7 @@ "eslint": "8.0.1", "jest": "27.3.1", "knex-cleaner": "1.3.1", + "nodemon": "^2.0.14", "supertest": "6.1.6" }, "license": "ISC"