Sign inSign up

viniciusschulz/backendchallenge

By viniciusschulz

•Updated almost 6 years ago

Trustly Technical Challenge for Developers

Image
0

300

viniciusschulz/backendchallenge repository overview

⁠Backend Challenge

Trustly Technical Challenge for Developers: API that returns the total number of lines and the total number of bytes of all the files of a given public Github repository, grouped by file extension.

⁠Author

Vinícius Schulz - [email protected]⁠

⁠Initial considerations

I builded the proposed challenge in three differents ways. The first one, i build using the Jsop library to manipulate the github's html page to found out the file's links (most efficient way). The second way, i builded the solution using the Jgit library, which i cloned the repository to a local directory, and then i read the file's properties (less efficient). At last, i builded using regular expression, to match file path name with my regex. Both solutions solve the problem, the difference are in resource usage; i consider the second one worst than others in this point, because i have a effort to clone the entire repository before begin read the file's properties.

⁠Source code

https://github.com/vinicius-schulz/backendchallenge

⁠Instructions to local execution

Run the follow command to pull backendchallenge's image from hub.docker.com to your local.

docker pull viniciusschulz/backendchallenge

Run the follow command to create and run a container.

docker run -idt -p <port>:8080 --name <container-name> viniciusschulz/backendchallenge

Ps: You can run only the second command. That will, pull, create and run automatically the container in daemon mode. Remember to choose the local port (for example: 8080) and define the container name.

Run the follow command to stop your created container.

docker container stop <container-name>

Run the follow command to remove your created container.

docker container rm -f <container-name>

⁠Documentation

http://<base-url>/swagger-ui.html
⁠API requisition example
⁠Method 1 - Using Soup
http://<base-url>/git-repository-information/github/jsoup/{workspace}/{repository}
⁠Method 2 - Using Jgit
http://<base-url>/git-repository-information/github/jgit/{workspace}/{repository}
⁠Method 3 - Using Regular Expression
http://<base-url>/git-repository-information/github/regex/{workspace}/{repository}

Tag summary

Content type

Image

Digest

Size

145.3 MB

Last updated

almost 6 years ago

docker pull viniciusschulz/backendchallenge