Affable manages your Blog through REST API and you can also see others' Blogs .
Insert gif or link to demo
To run this project, you will need to add the following environment variables to your config/default.json file
PORT
HOST
MONGO_URI
saltWorkFactor
jwtSecret
you can also take config/test.json as reference
Install my-project with npm
npm install
npm run dev #if your are a developer
npm run start
Import this JSON file into Postman Collection, and you will be able to use all REST APIs.
If you don't know how to do it, watch this video.
POST /api/v2/user/
Request Body | Type | Description |
---|---|---|
userName |
string |
Required .user's username |
email |
string |
Required .user's email |
password |
string |
Required .user's password |
passwordConfirmation |
string |
Required |
POST /api/v2/session/login
Request Body | Type | Description |
---|---|---|
email |
string |
Required .email of exist user |
passwrod |
string |
Required .password of that email |
GET /api/v2/user?
Request Query | Type | Description |
---|---|---|
userName |
string |
username of selected user |
email |
string |
email of selected user |
id |
Int |
id of selected user |
GET /api/v2/session/logout
POST /api/v2/blog/
Constraints | Type | Description |
---|---|---|
isAuthenticated |
middleware |
Required you must be logged in to create a post |
Request Body | Type | Description |
---|---|---|
title |
string |
Required .main title of blog |
description |
string |
describe your blog |
tags |
string |
tag your post to specific topic ["programming", "health", "sports"] |
GET /api/v2/blog?
Request Query | Type | Description |
---|---|---|
id |
string |
get blog with it's id |
author |
string |
get blogs for specific author |
DELETE /api/v2/blog/${id}
Constraints | Type | Description |
---|---|---|
isAuthenticated |
middleware |
Required you must be logged in to create a blog |
isAuthorized |
middleware |
Required you must be that owner of the blog |
Request Parameters | Type | Description |
---|---|---|
id |
string |
Required .id of deleted blog |
Contributions are always welcome!
- How to transition from javascript to typescript and reap the benefits of typescript.
- How to use Zod for validation.
- How to migrate MongDB and typescript.
- There is always something new to learn.