{"id":23127679,"url":"https://github.com/hlfshell/passwd-as-a-service","last_synced_at":"2025-04-04T05:42:21.683Z","repository":{"id":146170645,"uuid":"145223675","full_name":"hlfshell/passwd-as-a-service","owner":"hlfshell","description":"This is a coding sample as requested by an interviewing company - passwd and group as a (web) service","archived":false,"fork":false,"pushed_at":"2018-08-20T02:03:25.000Z","size":167,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T17:14:51.376Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hlfshell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-18T13:49:39.000Z","updated_at":"2025-01-01T20:30:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"935dc7ba-d261-4f4b-91bc-ef8424bedc0c","html_url":"https://github.com/hlfshell/passwd-as-a-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfshell%2Fpasswd-as-a-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfshell%2Fpasswd-as-a-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfshell%2Fpasswd-as-a-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfshell%2Fpasswd-as-a-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hlfshell","download_url":"https://codeload.github.com/hlfshell/passwd-as-a-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128739,"owners_count":20888234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-17T09:14:27.593Z","updated_at":"2025-04-04T05:42:21.666Z","avatar_url":"https://github.com/hlfshell.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Passwd as a service\n\nI was given a programming challenge from a potential employer in order to generate a coding sample. The goal is to create a `/etc/passwd` (and `/etc/group`) HTTP REST microservice. While you would never run this in real life due to securtiy concerns, it makes sense - pick a commonly available function with repeatable output and wrap it in an API for a code sample. The actual challenge as given is here in the repos under `challenge.pdf`.\n\n# Installing\nAfter cloning down the repos with `git clone git@github.com:hlfshell/passwd-as-a-service.git` - do an `npm install` in the directory. There is already a pre-built version ready to go, but you can run `npm run build` if you wish to re-build.\n\n# Tests\nTo run the tests, please run `npm run test`. If you need to build and test, `npm run build-and-test` will take care of you.\n\n## Human Testing\nIf you wish to play with the service manually, I've included an Insomnia REST workspace for quickly firing off requests to a running server.\n\n# Running the Server\nTo run the server, you can simply:\n\n```\nnpm run server\n```\nThe server will start up on a random open port.\n\nIf you wish to control options, such as port, `passwd` file path, or `groups` file path, you can use:\n\n```\nnpm run server -- --port 9000 --passwd /path/to/passwd --group /path/to/groups\n```\n\n# Code Structure\n\nI decided to use Typescript for this project. The more I use Typescript, the more I appreciate its utility in my coding flow. I find a lot of common typos and errors are caught by utilizing Typescript's features, and it consistently surprises me with its depth.\n\nYou'll find all Typescript files in `src` and the resulting compiled JavaScript files in `dist`.\n\nThe `cli` component executes a CLI for ease of setting configuration options for the server.\n\nThe `Server` object instantiates an express server and loads in routes. These routes, stored in `src/routes`, are objects that are organized by the name/goal of the route. Sometimes I create an additional layer of separation between routes and business logic - usually to handle incoming data validation per route - for modularity of code. I did not do this here, however, as it is a simple service that didn't require it.\n\nThe `classes` folder contains the two utility classes that handles all core functional logic of the service - reading, parsing, and querying the `passwd` and `group` files.\n\nAll tests are in `src/tests`, with some additional helper files in there to make testing easier. For instance, `finished` to fix `node-mocks-http` response mocks from having difficulty with async/await based code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlfshell%2Fpasswd-as-a-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhlfshell%2Fpasswd-as-a-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlfshell%2Fpasswd-as-a-service/lists"}