{"id":23228791,"url":"https://github.com/sord-dev/eco.io-backend","last_synced_at":"2025-04-05T18:28:06.922Z","repository":{"id":149095304,"uuid":"618557613","full_name":"sord-dev/eco.io-backend","owner":"sord-dev","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-31T08:47:45.000Z","size":124,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T15:52:48.904Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/sord-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":"2023-03-24T18:22:24.000Z","updated_at":"2023-04-06T10:08:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"a42adf33-49c4-4b73-abb3-bd21ed501fc7","html_url":"https://github.com/sord-dev/eco.io-backend","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/sord-dev%2Feco.io-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sord-dev%2Feco.io-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sord-dev%2Feco.io-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sord-dev%2Feco.io-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sord-dev","download_url":"https://codeload.github.com/sord-dev/eco.io-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247381888,"owners_count":20929973,"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-19T01:15:03.211Z","updated_at":"2025-04-05T18:28:06.915Z","avatar_url":"https://github.com/sord-dev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eco.io-backend\n\n![image](https://user-images.githubusercontent.com/75338985/228684978-dee0216b-39a8-4468-a62f-5b438540377f.png)\n\n\n## Requirements\n\n- .env file in root directory (with index.js, package.json)\n\n![image](https://user-images.githubusercontent.com/75338985/227611111-8cf936bc-7692-4f4e-b269-4279670c225f.png)\n\nInside of the .env file put these two values:\n```\nPORT=3000\nDB_URL=[Elephant SQL Instance URL](https://customer.elephantsql.com/instance/create)\nSESSION_SECRET=dhjkasdfasdhsdfkjsdfahgasdffasdgsdgsdfasdf\n```\n\n*any long string will be sufficient in the SESSION_SECRET row*\n\n- Inside of a terminal from the root directory, install the depenancies of the project.\n\n```\n$ npm install\n```\n\n- After this, run the command to start the server and go to [localhost:3000](http://localhost:3000)\n\n```\n$ npm run dev\n```\n\nExpected result:\n\n![image](https://user-images.githubusercontent.com/75338985/227611868-20cdf626-55b9-49f6-8149-7f396d4147e3.png)\n\n\n## Routes\n\n**auth routes**\n\n| Route | Description |\n|--------------|-------------|\n| POST /auth/login {user details in body} | login to existing account |\n| POST /auth/register {user details in body} | create a user |\n| GET /auth/logout {nothing in body} | logout |\n\nlogin user shape: \n*to /auth/login*\n```\n{\n    \"username\": \"test_usr\",\n    \"password\": \"test123\"\n}\n```\n\nregister user shape: \n*to /auth/register*\n```\n{\n    \"username\": \"admin\",\n    \"email\": \"admin@gmail.com\",\n    \"password\": \"admin\",\n    \"isAdmin\": true\n}\n```\n\n\n**event routes** - AUTH PROTECTED\n\n| Route | Description |\n|--------------|-------------|\n| GET /events/all  | show all events ordered by upvotes |\n| GET events/a/all  | get all approved events |\n| GET /events/ | get all user events (if admin) |\n| PATCH events/v/:event_id | vote for an event (if you don't own it) |\n| PATCH events/a/:event_id | approve an event |\n| POST /events/ {event object in body} | create a new event |\n| DELETE events/:event_id | delete a event |\n\nevent shape:\n*to /events/*\n```\n{\n\"event_id\": 1,\n\"owner_id\": 2,\n\"upvotes\": 99,\n\"title\": \"This is the title of the event.\",\n\"description\": \"this is the description of the even\",\n\"location\": \"London\"\n}\n```\n\nevent vote shape:\n*to /events/v/:event_id*\n```\n{\n\"votes\": 1\n}\n// OR\n{\n\"votes\": -1\n}\n```\n\n**user routes**\n\n| Route | Description |\n|--------------|-------------|\n| GET users/top | get the top 10 users ordered by events attended |\n| GET users/bookings/ | get all the users bookings depending on who's signed in |\n| GET users/h/bookings/ | get all the users attended bookings depending on who's signed in |\n| GET users/bookings/all | get all the users bookings ADMIN ONLY |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsord-dev%2Feco.io-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsord-dev%2Feco.io-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsord-dev%2Feco.io-backend/lists"}