{"id":22911908,"url":"https://github.com/awebcode/next-express-rest-api","last_synced_at":"2025-04-01T10:47:37.330Z","repository":{"id":265080088,"uuid":"895069775","full_name":"awebcode/Next-express-rest-api","owner":"awebcode","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-28T00:54:06.000Z","size":296,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-07T06:15:02.445Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awebcode.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":"2024-11-27T14:01:54.000Z","updated_at":"2024-11-28T00:54:10.000Z","dependencies_parsed_at":"2024-11-29T20:31:36.306Z","dependency_job_id":null,"html_url":"https://github.com/awebcode/Next-express-rest-api","commit_stats":null,"previous_names":["awebcode/next-express-crud"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awebcode%2FNext-express-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awebcode%2FNext-express-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awebcode%2FNext-express-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awebcode%2FNext-express-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awebcode","download_url":"https://codeload.github.com/awebcode/Next-express-rest-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246628418,"owners_count":20808106,"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-14T04:19:04.884Z","updated_at":"2025-04-01T10:47:37.312Z","avatar_url":"https://github.com/awebcode.png","language":"TypeScript","readme":"# Server: Backend API with Prisma\n\nThis directory contains the server-side implementation of the application. It uses **Prisma** as the ORM to interact with the database, providing a type-safe and efficient way to handle database operations.\n\n## Features\n\n- **Prisma ORM**: Type-safe database queries with auto-generated types.\n- **CRUD Operations**: Fully implemented CRUD functionality for managing products.\n- **REST API**: Endpoints to create, read, update, and delete resources.\n- **MONGODB Support**: Configured for a MONGODB database but easily adaptable to other relational databases.\n- **Environment Variables**: Centralized configuration for secure and flexible setup.\n\n## Prerequisites\n\nBefore starting, ensure you have the following installed:\n- **BUN** (v16 or later)\n- **MONGODB** (or your preferred relational database)\n- **Prisma CLI** (installed as a development dependency)\n\n## Getting Started\n\nFollow these steps to set up and run the server:\n\n### 1. Install Dependencies\n\nRun the following command in the `/server` directory to install all required dependencies:\n\n```bash\nbun install\n\nnpx prisma init\nnpx prisma generate\nnpx prisma migrate dev --name init\n\n\n\n/server\n├── prisma/\n│   ├── schema.prisma  # Prisma schema defining the database models\n├── src/\n│   ├── routes/        # API route handlers\n│   ├── controllers/   # Business logic\n│   ├── middlewares/   # Middleware for validation, error handling, etc.\n│   ├── index.ts       # Server entry point\n├── .env               # Environment variables\n├── package.json       # Node.js dependencies and scripts\n\nAPI Endpoints\n1. Create Product\nPOST /products\n\nRequest Body:\n\njson\n\n{\n  \"name\": \"Product Name\",\n  \"description\": \"Product Description\",\n  \"price\": 100\n}\nResponse:\n\njson\n\n{\n  \"product\": {\n    \"id\": \"1\",\n    \"name\": \"Product Name\",\n    \"description\": \"Product Description\",\n    \"price\": 100\n  }\n}\n2. Get All Products\nGET /products\n\nResponse:\njson\n\n{\n  \"products\": [\n    {\n      \"id\": \"1\",\n      \"name\": \"Product Name\",\n      \"description\": \"Product Description\",\n      \"price\": 100\n    }\n  ]\n}\n3. Update Product\nPUT /products/:id\n\nRequest Body:\n\njson\n\n{\n  \"name\": \"Updated Name\",\n  \"description\": \"Updated Description\",\n  \"price\": 200\n}\nResponse:\n\njson\n\n{\n  \"product\": {\n    \"id\": \"1\",\n    \"name\": \"Updated Name\",\n    \"description\": \"Updated Description\",\n    \"price\": 200\n  }\n}\n4. Delete Product\nDELETE /products/:id\n\nResponse:\njson\n\n{\n  \"message\": \"Product deleted successfully\"\n}\nProject Structure\n\n\n/server\n├── prisma/\n│   ├── schema.prisma  # Prisma schema defining the database models\n├── src/\n│   ├── routes/        # API route handlers\n│   ├── controllers/   # Business logic\n│   ├── middlewares/   # Middleware for validation, error handling, etc.\n│   ├── index.ts       # Server entry point\n├── .env               # Environment variables\n├── package.json       # Node.js dependencies and scripts\nTechnologies Used\nPrisma: ORM for database interaction\nExpress.js: Minimalist web framework\nPostgreSQL: Database management system\nTypeScript: Type-safe programming\nAdditional Commands\nFormat Prisma Schema:\n\n\nnpx prisma format\nView Database in Prisma Studio:\n\n\nnpx prisma studio\nContributing\nFeel free to contribute to this project by submitting issues or pull requests.\n\nLicense\nThis project is licensed under the MIT License.\n\ncss\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawebcode%2Fnext-express-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawebcode%2Fnext-express-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawebcode%2Fnext-express-rest-api/lists"}