Skip to content

Latest commit

 

History

History
101 lines (78 loc) · 2.03 KB

File metadata and controls

101 lines (78 loc) · 2.03 KB

Blogging Platform API

This is a simple crud API built using Typescript, Node JS, Express JS and MongoDB Database. Here does not have any auth feature.

Contents

How to run

API endpoints

Project Structure

Tech Stack

How to run

Go to terminal and run:

git clone https://github.com/mohammadhasansojib/blogging-platform-api.git

Then go to the the folder by running:

cd blogging-platform-api

install dependencies:

npm install

and run the following command to run the server:

npm start

API endpoints

  • get all the posts - GET /api/posts
  • get posts by filtering using specific keyword search - GET /api/posts?term=search_text
  • get a single post - GET /api/posts/:id
  • create a post - POST /api/posts
    • content to pass in body

      {
          title: {
              type: String,
              required: true
          },
          content: {
              type: String,
              required: true
          },
          category: {
              type: String,
              enum: ["Technology", "Sport", "Politics"],
              required: true
          },
          tags: {
              type: String,
              enum: ["Tech", "Programming", "Sport", "Politics"],
              required: true
          },
      }
  • update a post - PUT /api/posts/:id
    • any one field or multiple field can be passed to update
  • delete a post - DELETE /api/posts/:id

Project Structure

blogging-platform-api/
    ├── src/
    │   ├── controllers/
    │   │   └── controllers.ts
    │   ├── db/
    │   │   └── database.ts
    │   ├── routes/
    │   │   └── routes.ts
    │   └── server.ts
    ├── .env
    ├── .gitignore
    ├── package-lock.json
    ├── package.json
    ├── Readme.md
    └── tsconfig.json

Tech Stack

  • Language: Typescript
  • Environement: Node JS
  • Framework: Express JS
  • Database: MongoDB