Skip to content

zuukynn/ts-blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ts-blog (wip)

A simple but efficient blog back-end implementation made using TypeScript, Express, TypeORM and MongoDB.

purpose

The whole point of this back-end application is to learn more about JWT, authentication, and back-end itself.

roadmap

  • Create user logic
  • Create articles logic
  • Polish endpoints

endpoints

You can view details on how they work at the src/routes/index.ts file.

Note

Endpoints marked with * require you to be authenticated in order to access them.

create account

POST /users

Example request body:

{
  "username": "joaomanxxl",
  "password": "12345678"
}

Example response:

{
  "token": "account_token"
}

list all users*

GET /users

Example response:

{
  "users": [
     {
      "_id": "e9e84c2a-178c-46b1-8c40-6552c92af04c",
       "username": "joaomanxxl",
       "password": "$2b$10$YCMeeNxWXa2XaYDRTAr7/OMVsXyEheKxK4cniUIb7616oIEqZNeSe",
       "created_at": "2024-06-11T00:46:19.161Z",
       "token": "account_token"
       "articles": [],
    }
  ]
}

get user by their username*

GET /users/:username

Example response:

{
  "user": {
    "_id": "e9e84c2a-178c-46b1-8c40-6552c92af04c",
    "username": "joaomanxxl",
    "password": "$2b$10$YCMeeNxWXa2XaYDRTAr7/OMVsXyEheKxK4cniUIb7616oIEqZNeSe",
    "created_at": "2024-06-11T00:46:19.161Z",
    "token": "account_token",
    "articles": []
  }
}

update user password*

POST /users/recover

Example request body:

{
  "oldPassword": "12345678",
  "newPassword": "abcdefgh"
}

delete user*

DELETE /users/:username

Example response:

{
  "acknowledged": true
}

contributing

I don't really think anyone will contribute to this as it's mainly a learning project. Though, if you have any suggestions, you can either open an issue here or e-mail me at [email protected].

You can also take this code as "inspiration" or whatever, if it fits what you're looking for.

thanks for reading 👋

About

A simple blog back-end made in Typescript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published