A cloud-based solution that provides a REST API for creating, retrieving, updating, and deleting text and image fragments, with robust authorization, format conversion, and scalability features.
npm run lint
Run this script to identify errors and potential issues in the source code via ESLint.
ESLint documentation can be found here.
npm start
This will run the server normally on http://localhost:8080.
npm run dev
The dev script will run the server on http://localhost:8080 via Nodemon. It will monitor for any changes in the source code and automatically restart the server.
npm run debug
The debugging script is similar to the dev script, but connects a debugger to the process currently running on http://localhost:8080.
For instructions on using the VSCode debugger:
- https://code.visualstudio.com/docs/editor/debugging
- https://code.visualstudio.com/docs/nodejs/nodejs-debugging
This script runs all unit tests for all testing files serially.
npm test
This script runs unit tests only for the testing file specified at the end of the command.
npm test filename.test.js
Similar to npm test
, but will watch files for changes and re-run tests when a file is updated/saved without needing to input the command again.
npm run test:watch
Also similar to npm test
, but this script will generate a coverage report. The coverage report lists all of the files affected during testing and what percentage of statements, branches, functions, and lines were touched during the tests. It also includes which lines have no coverage at all.
npm run coverage
In addition to the terminal, the coverage report can be accessed by opening the HTML
file in a browser. The file can be accessed through the coverage
directory generated by the script. File path --> coverage/lcov-report/index.html
.
docker build -t fragments:latest .
This command will build the Dockerfile located in the current directory (i.e., .). Gives it a tag using -t fragments:latest, which defines a name (i.e., fragments) and a version (i.e., latest).
docker run --rm --name fragments fragments:latest
Flags:
--rm
: Automatically clean up the container and remove the file system when the container exits.--name
: Add custom container name.--env-file
: Specifyenv
file to use.-p
: Map a container’s port or a range of ports to the host explicitly.-e
: Pass environment variables to your containers.-d
: Detaches the container process and runs it in the background
docker run --rm --name fragments --env-file [ENV FILE] fragments:latest
docker run --rm --name fragments --env-file [ENV FILE] -p [HOST PORT #]:[CONTAINER PORT #] fragments:latest
docker run --rm --name fragments --env-file [ENV FILE] -e LOG_LEVEL=debug -p [HOST PORT #]:[CONTAINER PORT #] fragments:latest
docker run --rm --name fragments --env-file [ENV FILE] -e LOG_LEVEL=debug -p [HOST PORT #]:[CONTAINER PORT #] -d fragments:latest
docker tag [IMAGE_NAME]:[TAG] [NEW_IMAGE_NAME]:[TAG]
docker push [USERNAME]/[IMAGE]:[TAG]
docker push --all-tags [USERNAME]/[IMAGE]