API for the food waste reduction app, providing endpoints for managing store posts, real-time inventory updates, and location-based food search.
leftovers-api
├── prisma # Prisma ORM configuration and related files
│ ├── migrations # Stores database migration files
│ ├── schema.prisma # Defines the Prisma schema for the database
│ └── seeds.ts # Script for seeding the database with initial data
├── src # Source code of the application
│ ├── app.ts # Sets up and configures the application
│ ├── index.ts # Main entry point of the application
│ ├── middlewares.ts # Custom middleware functions for the application
│ ├── components # Contains application components
│ │ ├── component # Individual component controllers
│ │ │ ├── controller.ts # Contains the logic for a specific component
│ │ │ ├── network.ts # Sets up component routes
│ │ │ └── service.ts # Manages database queries
│ ├── database # Contains database configuration and setup files
│ │ └── client.ts # Initializes and configures the database connection
│ ├── router # Contains route definitions
│ │ └── index.ts # Main router setup
│ └── types # Custom TypeScript types
│ └── index.ts # Type definitions
├── package.json # Project metadata and dependencies
├── tsconfig.json # TypeScript configuration
└── README.md # Project documentation
To install the dependencies, run:
yarn installTo start the application, use the following command:
yarn devRun the following commands to generate the migrations and apply them to your database:
npx prisma migrate dev --name migration_nameIf you don’t want to reset the database but still apply the latest migration, run:
npx prisma migrate deployIf you want to completely reset the database (including seeding), you can use the following command:
npx prisma migrate resetGenerate the Prisma Client to interact with your database in your Express app:
npx prisma generateRun the seeding script using Prisma:
npx prisma db seedTo run the tests, use the following command:
yarn testThis project is licensed under the MIT License.