{"id":25412854,"url":"https://github.com/parambirs/todo-backend-typescript","last_synced_at":"2025-10-31T07:30:59.052Z","repository":{"id":74830156,"uuid":"50394497","full_name":"parambirs/todo-backend-typescript","owner":"parambirs","description":"TypeScript/Node.js/Express implementation of the Todo-Backend API spec","archived":false,"fork":false,"pushed_at":"2024-01-09T06:14:12.000Z","size":75,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-01-10T05:53:38.624Z","etag":null,"topics":["express","expressjs","node-js","nodejs","todo-backend","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parambirs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-26T01:41:32.000Z","updated_at":"2024-01-10T05:53:38.625Z","dependencies_parsed_at":"2023-04-20T12:17:16.587Z","dependency_job_id":null,"html_url":"https://github.com/parambirs/todo-backend-typescript","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parambirs%2Ftodo-backend-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parambirs%2Ftodo-backend-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parambirs%2Ftodo-backend-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parambirs%2Ftodo-backend-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parambirs","download_url":"https://codeload.github.com/parambirs/todo-backend-typescript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239134088,"owners_count":19587406,"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":["express","expressjs","node-js","nodejs","todo-backend","typescript"],"created_at":"2025-02-16T13:35:54.816Z","updated_at":"2025-10-31T07:30:53.667Z","avatar_url":"https://github.com/parambirs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# todo-backend-typescript\n\nThis is an example implementation of [moredip's](https://github.com/moredip)\n[Todo-Backend](http://todobackend.com/) API spec, using TypeScript, Node.js\nand the Express framework.\n\nThis example saves TODOs in a PostgreSQL database and uses\n[node-db-migrate](https://github.com/kunklejr/node-db-migrate)\nfor database migrations. The code can be deployed to heroku.\n\nThis code is based on the [todo-backend-express](https://github.com/dtao/todo-backend-express)\nexample on the [http://todobackend.com/](http://todobackend.com/) site.\n\n## 1. Install dependencies\n\n``` bash\n\u003e npm install\n\u003e npm install -g typescript # typescript compiler\n\u003e npm install -g tsd # typescript definition manager\n```\n\n#### Install type definitions\n\n```bash\n% tsd install\n```\n\n## 2. Set up postgres db (OSX)\n\n#### Run postgres via docker\n\n```bash\n\u003e docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres\n```\n\n#### Create user and database\n\n```\n\u003e docker exec -it some-postgres bash\n\\# createuser -U postgres -d -P -E db_user\n\\# createdb -U postgres --owner db_user --encoding utf8 tododb\n```\n\n#### Create table\n\n```bash\n\u003e ./node_modules/db-migrate/bin/db-migrate up\n[INFO] Processed migration 20160119093012-create-todos\n[INFO] Processed migration 20160119093812-add-order-to-todos\n[INFO] Done\n```\n\n## 3. Compile TypeScript\n\n```bash\n\u003e tsc\n```\n\n## 4. Run the server\n\n#### fish shell\n\n```\n\u003e set -x DATABASE_URL postgres://db_user:db_pass@localhost/tododb\n\u003e node app/server.js\n```\n\n#### bash/zsh\n\n```bash\n% DATABASE_URL=postgres://db_user:db_pass@localhost/tododb node server.js\n```\n\n## 5. Test the server\n\nI use [httpie](https://github.com/jkbrzt/httpie) utility to test REST API calls from the terminal. You can install it\non OSX with brew.\n\n```bash\n\u003e brew install httpie\n```\n\nYou can also use the built-in `curl` command if you don't want to install `httpie`.\n\n#### Test 'create todo' api\n\n```bash\n\u003e curl -d '{\"title\": \"Deploy on Heroku\", \"order\": 1}' -H \"Content-Type: application/json\" -X POST http://localhost:5050\n\n\u003e http post :5050 title='Deploy on Heroku' order=1\n\nHTTP/1.1 200 OK\nAccess-Control-Allow-Headers: Content-Type\nAccess-Control-Allow-Methods: GET,POST,PATCH,DELETE\nAccess-Control-Allow-Origin: *\nConnection: keep-alive\nContent-Length: 88\nContent-Type: application/json; charset=utf-8\nDate: Tue, 26 Jan 2016 01:13:48 GMT\nETag: W/\"58-6XGc4CPnaa+/LbxwvorWgw\"\nX-Powered-By: Express\n\n{\n    \"completed\": false,\n    \"order\": 1,\n    \"title\": \"Deploy on Heroku\",\n    \"url\": \"http://localhost:5000/1\"\n}\n```\n\n#### Test 'get all todos' api\n\n```bash\n\u003e curl -v -X GET localhost:5050/\n\n\u003e http :5050\n\nHTTP/1.1 200 OK\nAccess-Control-Allow-Headers: Content-Type\nAccess-Control-Allow-Methods: GET,POST,PATCH,DELETE\nAccess-Control-Allow-Origin: *\nConnection: keep-alive\nContent-Length: 90\nContent-Type: application/json; charset=utf-8\nDate: Tue, 26 Jan 2016 01:14:14 GMT\nETag: W/\"5a-I5kxfNHhoZBy7GPZa6prYg\"\nX-Powered-By: Express\n\n[\n    {\n        \"completed\": false,\n        \"order\": 1,\n        \"title\": \"Deploy on Heroku\",\n        \"url\": \"http://localhost:5000/1\"\n    }\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparambirs%2Ftodo-backend-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparambirs%2Ftodo-backend-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparambirs%2Ftodo-backend-typescript/lists"}