{"id":21412750,"url":"https://github.com/souris-dev/appointytaskgo","last_synced_at":"2026-04-29T22:07:12.509Z","repository":{"id":72829837,"uuid":"415102995","full_name":"souris-dev/AppointyTaskGo","owner":"souris-dev","description":"Task for internship recruitment at Appointy for Vellore Institute of Technology, 2021.","archived":false,"fork":false,"pushed_at":"2021-10-10T02:46:09.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-23T05:14:22.616Z","etag":null,"topics":["api","backend","golang","mongodb"],"latest_commit_sha":null,"homepage":"https://souris-dev.github.io/AppointyTaskGo/","language":"Go","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/souris-dev.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":"2021-10-08T19:20:42.000Z","updated_at":"2021-10-10T03:07:30.000Z","dependencies_parsed_at":"2023-02-26T23:01:01.910Z","dependency_job_id":null,"html_url":"https://github.com/souris-dev/AppointyTaskGo","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/souris-dev%2FAppointyTaskGo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souris-dev%2FAppointyTaskGo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souris-dev%2FAppointyTaskGo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/souris-dev%2FAppointyTaskGo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/souris-dev","download_url":"https://codeload.github.com/souris-dev/AppointyTaskGo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910763,"owners_count":20367544,"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":["api","backend","golang","mongodb"],"created_at":"2024-11-22T18:15:27.744Z","updated_at":"2026-04-29T22:07:07.489Z","avatar_url":"https://github.com/souris-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mock Instagram Backend\n\nThis is an API created for a mock Instagram-like application for the internship recruitment task of Appointy in September, 2021 for Vellore Institute of Technology.\nThis API has been used using Golang and using `net/http` (along with other standard libraries) and no other external libraries or frameworks have been used as per the directions.\n\n## Technologies Used\n\nThis backend is written in Golang and uses standard libraries for JSON encoding/decoding and `net/http` for routing and serving. The API is designed to communicate in JSON with its client.\nMongoDB is used as the database as specified in the requirements of the task.\n\n## Building the source\nEnsure that Golang is installed and set up in your system.\nFirst, clone this repository into a folder. Change directory to that folder.\n\n```sh\ngit clone \u003cthis repository's URL.git\u003e\ncd AppointyTaskGo\n```\n\nNext, build the project. The API uses the Go driver for MongoDB. Building the project should automatically fetch the dependencies.\nFrom within this directory (project root), run:\n\n```sh\ngo build\n```\n\n## Running the API\n\nTo run the API, first set the environment variables `MONGODB_URI`, `MONGODB_DBNAME` and `APPYINSTA_PORT`.\n\n### Linux\n\n```sh\nexport MONGODB_URI=\u003cyour connection string\u003e\nexport MONGODB_DBNAME=\u003cyour database name\u003e\nexport APPYINST_PORT=\u003con which port to run the server\u003e\n```\n\n### Windows (Powershell)\n```ps\n$Env:MONGODB_URI = \"\u003c...\u003e\"\n$Env:MONGODB_DBNAME = \"\u003c...\u003e\"\n$Env:APPYINSTA_PORT = \"\u003cport\u003e\"\n```\n\nYou can also set these environment variables using other methods.\n\nAfter this, run the executable created after building it.\n\n### Linux\n```sh\n./appyinsta\n```\nYou may have to change permissions for executing this.\n\n### Windows (Powershell)\n```ps\n./appyinsta\n```\n\nThe server will now run on the specified port (as specified in the `APPYINSTA_PORT` environment variable).\n\n## API Specification\n\nA simple overview of the API is as follows. The API has been designed and created as per the requirements specified in the task.\n\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eRoute\u003c/th\u003e\n    \u003cth\u003eMethod\u003c/th\u003e\n    \u003cth\u003eDescription\u003c/th\u003e\n    \u003cth\u003eRequest Body (Sample)\u003c/th\u003e\n    \u003cth\u003eResponse Body\u003c/th\u003e\n  \u003c/tr\u003e\n  \n  \u003ctr\u003e\n    \u003ctd\u003e/users\u003c/td\u003e\n    \u003ctd\u003ePOST\u003c/td\u003e\n    \u003ctd\u003eCreate a user\u003c/td\u003e\n    \u003ctd\u003e\n      \u003cpre\u003e\njson\n{\n  \"name\": \"(name)\",\n  \"email\": \"(email)\",\n  \"password\": \"(password)\"\n}\n      \u003c/pre\u003e\n      The password is hashed again at the server. All fields are compulsory. \u003cbr/\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n    \u003cpre\u003e\njson\n{\n  \"id\": \"(user ID)\"\n}\n    \u003c/pre\u003e\n      The user ID (MongoDB object ID) of the new user is returned after user creation.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e/users/\u0026lt;userID\u0026gt;\u003c/td\u003e\n    \u003ctd\u003eGET\u003c/td\u003e\n    \u003ctd\u003eRetrieve information about a user\u003c/td\u003e\n    \u003ctd\u003eN/A\u003c/td\u003e\n    \u003ctd\u003e\u003cpre\u003e\njson\n{\n  \"id\": \"(user ID)\",\n  \"name\": \"(name)\",\n  \"email\": \"(email)\",\n}\n      \u003c/pre\u003e\n      The \u003ci\u003eid\u003c/i\u003e field has the same user ID as specified in the URL.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e/posts\u003c/td\u003e\n    \u003ctd\u003ePOST\u003c/td\u003e\n    \u003ctd\u003eCreate a post\u003c/td\u003e\n    \u003ctd\u003e\n    \u003cpre\u003e\njson\n{\n    \"posted_by\": \"(user ID )\",\n    \"caption\": \"(caption)\",\n    \"img_url\": \"(image URL)\"\n}\n    \u003c/pre\u003e\n      The \u003ci\u003eposted_by\u003c/i\u003e field contains the user ID of the user who created this post.\n      While post creation, the timestamp of its creation is recorded at the server.\n    \u003c/td\u003e\n    \u003ctd\u003e\n    \u003cpre\u003e\njson\n{\n  \"id\": \"(post ID)\"\n}\n    \u003c/pre\u003e\n      The post ID (MongoDB object ID) of the new post is returned after post creation.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e/posts/\u0026lt;postID\u0026gt;\u003c/td\u003e\n    \u003ctd\u003eGET\u003c/td\u003e\n    \u003ctd\u003eRetrieve information about a post\u003c/td\u003e\n    \u003ctd\u003eN/A\u003c/td\u003e\n    \u003ctd\u003e\n    \u003cpre\u003e\njson\n{\n  \"id\": \"(post ID)\",\n  \"posted_by\": \"(user ID)\",\n  \"caption\": \"(caption)\",\n  \"img_url\": \"(image URL)\",\n  \"posted_on\": \"(timestamp)\"\n}\n    \u003c/pre\u003e\n      The \u003ci\u003eid\u003c/i\u003e field has the same post ID as specified in the URL.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e/posts/users/\u0026lt;userID\u0026gt;\u003c/td\u003e\n    \u003ctd\u003eGET\u003c/td\u003e\n    \u003ctd\u003eRetrieve the posts created by the user, latest first.\u003c/td\u003e\n    \u003ctd\u003e\n      \u003cb\u003eFirst Request\u003c/b\u003e\u003cbr /\u003e\u003cbr /\u003e\n      For the first request, the \u003ci\u003efirst_request\u003c/i\u003e must be set to true. \u003cbr /\u003e\n      The \u003ci\u003elast_id\u003c/i\u003e field can be set as the userID (or any post ID). \u003cbr /\u003e\n      The \u003ci\u003elast_posted_on\u003c/i\u003e should be any string of a valid timestamp format (for example: \n      2021-10-09T12:17:11.478Z). \u003cbr /\u003e\n      The request body format for the first request is as follows:\n      \u003cpre\u003e\njson\n{\n  \"last_id\": \"(user ID)\",\n  \"last_posted_on\": \"(timestamp)\",\n  \"n_new\": 3,\n  \"first_request\": true\n}\n    \u003c/pre\u003e\n      The \u003ci\u003en_new\u003c/i\u003e field sets how many posts should be retrieved.\n      \u003cbr /\u003e\u003cbr /\u003e\n      \u003cb\u003eSubsequent Requests\u003c/b\u003e\u003cbr /\u003e\u003cbr /\u003e\n       For the subsequent requests, the request format is similar.\u003cbr /\u003e\n       The \u003ci\u003elast_id\u003c/i\u003e field should have the post ID of the last post \u003cbr /\u003e\n       of the previous response. \u003cbr /\u003e\n       The \u003ci\u003elast_posted_on\u003c/i\u003e field should have the posted_on timestamp of \u003cbr /\u003e\n       the last post of the previous response. \u003cbr /\u003e\n       The \u003ci\u003efirst_request\u003c/i\u003e field must be set to false, or can be omitted.\n    \u003c/td\u003e\n    \u003ctd\u003e\n     \u003cpre\u003e\njson\n[\n    {\n        \"id\": \"(post ID)\",\n        \"posted_by\": \"(user ID)\",\n        \"caption\": \"(caption)\",\n        \"img_url\": \"(image URL)\",\n        \"posted_on\": \"(timestamp)\"\n    },\n    ...\n    {\n        \"id\": \"(post ID)\",\n        \"posted_by\": \"(user ID)\",\n        \"caption\": \"(caption)\",\n        \"img_url\": \"(image URL)\",\n        \"posted_on\": \"(timestamp)\"\n    }\n]\n    \u003c/pre\u003e\n      This array will contain maximum \u003ci\u003en_new\u003c/i\u003e number of posts (as specified in the request body).\n      The posts are returned in the most recent first order.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n    \n\u003c/table\u003e\n\n\n## Running Unit Tests\n\nEnsure that the required environment variables are set (see the \"Running the API section\"), and go to the project root directory and run:\n\n```sh\ngo test appyinsta/api/handlers\n```\n\n(As of now, the tests depend on existing data in the database, and will fail if that data is not present. A mechanism to add test data will be added.)\n\n## Licence\n\nWill be added soon.\n\n\n\n2021, Souris Ash\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouris-dev%2Fappointytaskgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsouris-dev%2Fappointytaskgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouris-dev%2Fappointytaskgo/lists"}