{"id":22559666,"url":"https://github.com/taurusilver7/typescript-api","last_synced_at":"2025-03-28T12:12:07.616Z","repository":{"id":224589677,"uuid":"763645066","full_name":"taurusilver7/typescript-api","owner":"taurusilver7","description":"A CRUD API built with Typescript, Zod, Jest \u0026 MongoDB","archived":false,"fork":false,"pushed_at":"2024-03-04T04:39:21.000Z","size":98,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T12:35:46.909Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/taurusilver7.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-26T17:11:21.000Z","updated_at":"2024-02-26T17:15:59.000Z","dependencies_parsed_at":"2025-02-02T12:34:36.263Z","dependency_job_id":"afe6b714-9405-494b-bb6c-11c6c7bdab94","html_url":"https://github.com/taurusilver7/typescript-api","commit_stats":null,"previous_names":["taurusilver7/typescript-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taurusilver7%2Ftypescript-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taurusilver7%2Ftypescript-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taurusilver7%2Ftypescript-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taurusilver7%2Ftypescript-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taurusilver7","download_url":"https://codeload.github.com/taurusilver7/typescript-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246026110,"owners_count":20711581,"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-07T21:07:53.506Z","updated_at":"2025-03-28T12:12:07.596Z","avatar_url":"https://github.com/taurusilver7.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typescript API\n\n\u003e A CRUD API built with Express JS, Typescript as forerunner language, Mongodb, zod validation and Jest\n\nInstead of building the structure from scratch, use a template to create a starter directory, ready for development.\n\n```bash\nnpx create-express-api --typescript --directory api_name\n```\n\nIncludes API Server utilities:\n\n-  [morgan](https://www.npmjs.com/package/morgan) HTTP request logger middleware for node.js\n-  [helmet](https://www.npmjs.com/package/helmet) Helmet helps you secure your Express apps by setting various HTTP headers. It's not a silver bullet, but it can help!\n-  [dotenv](https://www.npmjs.com/package/dotenv)\n   Dotenv is a zero-dependency module that loads environment variables from a `.env` file into `process.env`\n-  [cors](https://www.npmjs.com/package/cors)\n   CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.\n\nDevelopment utilities:\n\n-  [typescript](https://www.npmjs.com/package/typescript)\n   TypeScript is a language for application-scale JavaScript.\n-  [ts-node](https://www.npmjs.com/package/ts-node)\n   TypeScript execution and REPL for node.js, with source map and native ESM support.\n-  [nodemon](https://www.npmjs.com/package/nodemon)\n   nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.\n-  [eslint](https://www.npmjs.com/package/eslint)\n   ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code.\n-  [typescript-eslint](https://typescript-eslint.io/)\n   Tooling which enables ESLint to support TypeScript.\n-  [jest](https://www.npmjs.com/package/mocha)\n   Jest is a delightful JavaScript Testing Framework with a focus on simplicity.\n-  [supertest](https://www.npmjs.com/package/supertest)\n   HTTP assertions made easy via superagent.\n\n## Available Scripts\n\n```bash\nnpm install\n# lint exec\nnpm run lint\n# test run\nnpm run test\n# dev server\nnpm run dev\n```\n\n## Build\n\nThe `app.ts` loads the express app with the basic middlewares provided, while the `index.ts` in src directory starts the express server on a designated port on a local machine.\n\nKeep the app \u0026 index as seperate stand-alone files to run the test on app server \u0026 listener separately.\n\nThe `api/index.ts` holds all the routes \u0026 `middleware` in src holds the custom middlewares like error handling \u0026 not-found cases.\n\nStick to eith MVC architecture or a feature-based structure. For the latter, all the functions regarding a feature are stacked in a directory. src/api/todo directory\n\nCreate a route \u0026 data model for the todo, and write a test case for the expected output from the todo routes. Create the routes \u0026 their corresponding handler function before writing their test cases. With each route defined, their corresponding test cases complicates.\n\nSetup the database in the src directory. Create a mongo client instance for the database using the connection string from the env variable.\n\nSeparate the async handler function in the routes to a controller, corresponding to the route.\n\nThe server usually has the error handler as the last register in its middleware chain. The error handler is called whenever a controller function calls for a next method with an error.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaurusilver7%2Ftypescript-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaurusilver7%2Ftypescript-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaurusilver7%2Ftypescript-api/lists"}