Build a full stack JavaScript app that is functionally similar to this: <ahref="https://issue-tracker.freecodecamp.rocks/"target="_blank">https://issue-tracker.freecodecamp.rocks/</a>. Working on this project will involve you writing your code using one of the following methods:
- Clone <ahref='https://github.com/freeCodeCamp/boilerplate-project-issuetracker/'target='_blank'>this GitHub repo</a> and complete your project locally.
- Use <ahref="https://repl.it/github/freeCodeCamp/boilerplate-project-issuetracker"target='_blank'>this repl.it starter project</a> to complete your project.
- Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
- Complete the neccessary routes in `/routes/api.js`
- Create all of the functional tests in `tests/2_functional-tests.js`
- Copy the `sample.env` file to `.env` and set the variables appropriately
- To run the tests uncomment `NODE_ENV=test` in your `.env` file
- To run the tests in the console, use the command `npm run test`. To open the Repl.it console, press Ctrl+Shift+P (Cmd if on a Mac) and type "open shell"
- text: You can send a `POST` request to `/api/issues/{projectname}` with form data containing the required fields `issue_title`, `issue_text`, `created_by`, and optionally `assigned_to` and `status_text`.
testString: 'async getUserInput => {
try {
let test_data = {
issue_title: "Faux Issue Title",
issue_text: "Functional Test - Required Fields Only",
created_by: "fCC",
};
const data = await $.post(getUserInput("url") + "/api/issues/fcc-project", test_data);
assert.isObject(data);
assert.nestedInclude(data, test_data);
} catch(err) {
throw new Error(err.responseText || err.message);
}
}'
- text: The `POST` request to `/api/issues/{projectname}` will return the created object, and must include all of the submitted fields. Excluded optional fields will be returned as empty strings. Additionally, include `created_on` (date/time), `updated_on` (date/time), `open` (boolean, `true` for open - default value, `false` for closed), and `_id`.
testString: 'async getUserInput => {
try {
let test_data = {
issue_title: "Faux Issue Title 2",
issue_text: "Functional Test - Every field filled in",
created_by: "fCC",
assigned_to: "Chai and Mocha",
};
const data = await $.post(getUserInput("url") + "/api/issues/fcc-project", test_data);
assert.isObject(data);
assert.nestedInclude(data, test_data);
assert.property(data, "created_on");
assert.isNumber(Date.parse(data.created_on));
assert.property(data, "updated_on");
assert.isNumber(Date.parse(data.updated_on));
assert.property(data, "open");
assert.isBoolean(data.open);
assert.isTrue(data.open);
assert.property(data, "_id");
assert.isNotEmpty(data._id);
assert.property(data, "status_text");
assert.isEmpty(data.status_text);
} catch(err) {
throw new Error(err.responseText || err.message);
}
}'
- text: If you send a `POST` request to `/api/issues/{projectname}` without the required fields, returned will be the error `{ error:'required field(s) missing' }`
- text: You can send a `GET` request to `/api/issues/{projectname}` for an array of all issues for that specific `projectname`, with all the fields present for each issue.
- text: You can send a `GET` request to `/api/issues/{projectname}` and filter the request by also passing along any field and value as a URL query (ie. `/api/issues/{project}?open=false`). You can pass one or more field/value pairs at once.
- text: You can send a `PUT` request to `/api/issues/{projectname}` with an `_id` and one or more fields to update. On success, the `updated_on` field should be updated, and returned should be `{ result:'successfully updated', '_id':_id }`.
- text: When the `PUT` request sent to `/api/issues/{projectname}` does not include update fields, the return value is `{ error:'no update field(s) sent', '_id':_id }`. On any other error, the return value is `{ error:'could not update', '_id':_id }`.
- text: You can send a `DELETE` request to `/api/issues/{projectname}` with an `_id` to delete an issue. If no `_id` is sent, the return value is `{ error:'missing _id' }`. On success, the return value is `{ result:'successfully deleted', '_id':_id }`. On failure, the return value is `{ error:'could not delete', '_id':_id }`.