Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bm-mit/blogging-platform-api
A solution to Blogging Platform API project at roadmap.sh Backend projects
https://github.com/bm-mit/blogging-platform-api
nestjs nestjs-backend
Last synced: 4 days ago
JSON representation
A solution to Blogging Platform API project at roadmap.sh Backend projects
- Host: GitHub
- URL: https://github.com/bm-mit/blogging-platform-api
- Owner: bm-mit
- Created: 2024-09-07T15:27:39.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-08T03:58:35.000Z (4 months ago)
- Last Synced: 2024-10-31T23:05:55.412Z (about 2 months ago)
- Topics: nestjs, nestjs-backend
- Language: TypeScript
- Homepage: https://roadmap.sh/projects/blogging-platform-api/solutions?u=657f35ee5145316d25185b0d
- Size: 835 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [Roadmap.sh](https://roadmap.sh) - Blogging Platform API Backend Project
A **NestJS** solution of [Blogging Platform API](https://roadmap.sh/projects/blogging-platform-api)
## Setup
### Setup PostgreSQL
```PostgreSQL
--You can change user, password and database name inside main.ts.
CREATE USER "blogging-platform-api" WITH ENCRYPTED PASSWORD 'password';CREATE DATABASE "blogging-platform-api" OWNER "blogging-platform-api";
```### Setup project
```bash
# Install dependencies
yarn# Run dev server
yarn start:dev# Run production server
yarn build
yarn start
```## Endpoints
- `GET /posts?term=term`
- Get all posts with term in title, content, tags or category.
- Query: `term: string`
- Default: `term: ''`
- Response: `[ { id: number, title: string, content: string, category: string, tags: string[], created_at: Date, updated_at: Date } ]`
- Http Status: 200
- `POST /posts/`
- Create a new post.
- Body: `{ title: string, content: string, category: string, tags: string[] }`
- Response: `{ id: number, title: string, content: string, category: string, tags: string[], created_at: Date, updated_at: Date }`
- Http Status: 201
- If JSON body is invalid, it will return 400.
- `PUT /posts/:id`
- Update a post.
- Body: `{ title: string, content: string, category: string, tags: string[] }`
- All fields inside body are optional.
- Response: `{ id: number, title: string, content: string, category: string, tags: string[], created_at: Date, updated_at: Date }`
- Http Status: 200
- If JSON body is invalid, it will return 400.
- If post does not exist, it will return 404.
- `DELETE /posts/:id`
- Delete a post.
- Http Status: 204
- If post does not exist, it will return 404.