Feedback Service API is a server-side application for managing feedbacks, providing users with the ability to create suggestions, vote for them, and filter them by categories and statuses.
- Node.js with TypeScript
- Express.js for routing
- Prisma ORM to work with the database
- PostgreSQL as a database
- Swagger for API documentation
- JWT for authentication
The Production server is available at: https://feedback-service-fnhf.onrender.com/api-docs
In order to launch the server locally, follow these steps:
git clone https://github.com/DosymzhanKogabaev/feedback-service.git
cd feedback-servicenpm installCreate a .env file in the root of the project and add the following variables:
DATABASE_URL="postgresql://<user>:<password>@<host>:<port>/<database>"
JWT_SECRET="<your_jwt_secret>"
PORT=5000-
Synchronize the Prisma schema with the database:
npx prisma migrate dev --name init
-
Fill the
CategoryandStatustables with data:npx ts-node src/prisma/seed.ts
-
Open Prisma Studio to view the data:
npx prisma studio
npm run devThe server will be running on http://localhost:5000.
| Метод | URL | Описание |
|---|---|---|
| POST | /auth/register |
New User Registration |
| POST | /auth/login |
User authorization |
| GET | /auth/me |
Getting current user data |
| Метод | URL | Описание |
|---|---|---|
| GET | /feedback |
Receive all feedbacks |
| POST | /feedback |
Create a new feedback |
| GET | /feedback/{id} |
Receive a feedback data by ID |
| PUT | /feedback/{id} |
Update a feedback by ID |
| DELETE | /feedback/{id} |
Delete a feedback by ID |
| Метод | URL | Описание |
|---|---|---|
| POST | /upvotes/{id} |
Add an upvote for a feedback by its ID |
| DELETE | /upvotes/{id} |
Delete an upvote by feedback's ID |
| Метод | URL | Описание |
|---|---|---|
| GET | /categories |
Get the list of all categories |
| GET | /statuses |
Get the list of all statuses |
API documentation will be available at:
http://localhost:5000/api-docs
URL: POST /auth/register
Request body example:
{
"email": "user@example.com",
"password": "password123",
"avatar": "https://example.com/avatar.png"
}Result example:
{
"message": "User registered successfully",
"user": {
"id": 1,
"email": "user@example.com",
"password": "$2b$10$fvIo7n7JydBin0zznIz18.MovJZAX7wdKUTZsPu2Vx4yb8hByan3C",
"avatar": "https://example.com/avatar.png",
"createdAt": "2025-01-04T12:34:56.789Z"
}
}npm run dev— Запуск сервера в режиме разработкиnpm run build— Сборка проекта в папкуdistnpm start— Запуск собранного проекта