* fix/change-node-project-descriptions-to-all-use-same-template * fix: use correct boilerplate Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> * fix: add url to link text Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> * fix: add _blank for target attribute Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> * fix: add missing single quote Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> * fix: remove extra lines * fix: improved wording of description Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com> * fix: move sentence to previous paragraph Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com> * fix: move sentence to previous paragraph * fix: move sentence to previous paragraph Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>
3.1 KiB
3.1 KiB
id, title, challengeType, forumTopicId
id | title | challengeType | forumTopicId |
---|---|---|---|
bd7158d8c443edefaeb5bd0f | File Metadata Microservice | 4 | 301506 |
Description
- Clone this GitHub repo and complete your project locally.
- Use our repl.it starter project 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 projects source code in the GitHub Link
field.
Instructions
HINT: You can use the multer
npm package to handle file uploading.
Tests
tests:
- text: You should provide your own project, not the example URL.
testString: |
getUserInput => {
assert(!/.*\/file-metadata-microservice\.freecodecamp\.rocks/.test(getUserInput('url')));
}
- text: You can submit a form that includes a file upload.
testString: "async getUserInput => {
const site = await fetch(getUserInput('url'));
const data = await site.text();
const doc = new DOMParser().parseFromString(data, 'text/html');
assert(doc.querySelector('input[type=\"file\"]'));
}"
- text: The form file input field has the `name` attribute set to `upfile`.
testString: "async getUserInput => {
const site = await fetch(getUserInput('url'));
const data = await site.text();
const doc = new DOMParser().parseFromString(data, 'text/html');
assert(doc.querySelector('input[name=\"upfile\"]'));
}"
- text: When you submit a file, you receive the file `name`, `type`, and `size` in bytes within the JSON response.
testString: "async getUserInput => {
const formData = new FormData();
const fileData = await fetch('https://cdn.freecodecamp.org/weather-icons/01d.png');
const file = await fileData.blob();
formData.append('upfile', file, 'icon');
const data = await fetch(getUserInput('url') + '/api/fileanalyse', {
method: 'POST', body: formData
});
const parsed = await data.json();
assert.property(parsed, 'size');
assert.equal(parsed.name, 'icon');
assert.equal(parsed.type, 'image/png');
}"
Challenge Seed
Solution
/**
Backend challenges don't need solutions,
because they would need to be tested against a full working project.
Please check our contributing guidelines to learn more.
*/