Skip to content

papakowdadson/slightly_Techie_Blog

Repository files navigation

slightly_Techie_Blog

A Simple Blog Api With Nodejs and Mysql

This is just me building on my ST entry task. Nothing wild

Requirement

  • Must have XAMPP or Workbench installed.
  • Must have redis installed.
  • Must have nodejs installed
  • Postman for easier testing of API (Optional)

How to use

  • Clone or fork repo
  • Change directory to slightly_Techie_Blog cd slightly_Techie_Blog
  • Install packages `npm install'
  • Create your env file using env.sample
  • Start server npm start

General EndPoints

Create Blog

Method : POST
url : http://localhost:5000/blog/{api_version}/create/
Body (json)
{ "image":"", "title":"Second Post", "content":"The second post content", "author":"Papa Kow Dadson" }

Get All Blog

Method : GET
url : http://localhost:5000/blog/{api_version}/

Get Single Blog

Method : GET
url : http://localhost:5000/blog/{api_version}/:id

Update Blog

Method : PUT
url : http://localhost:5000/blog/{api_version}/update/:id
Body (json)
{ "title":"First post updated", "content":"The content was just updated" }

Delete Blog

Method : DELETE
url : http://localhost:5000/blog/{api_version}/delete/:id

EndPoints With Prisma

Create Blog

Method : POST
url : http://localhost:5000/blog/{api_version}/prisma/create/
Body (json)
{ "image":"", "title":"Second Post", "content":"The second post content", "author":"Papa Kow Dadson" }

Get All Blog

Method : GET
url : http://localhost:5000/blog/{api_version}/prisma/

Get Single Blog

Method : GET
url : http://localhost:5000/blog/{api_version}/prisma/:id

Update Blog

Method : PUT
url : http://localhost:5000/blog/{api_version}/prisma/update/:id
Body (json)
{ "title":"First post updated", "content":"The content was just updated" }

Delete Blog

Method : DELETE
url : http://localhost:5000/blog/{api_version}/prisma/delete/:id

New Scope if necessary

Image upload

Technology

  • Nodejs(express)
  • Mysql

Packages

  • nodemon : Automatic server restart
  • body-parser : Passing of JSON values
  • redis : Caching
  • Prisma : serialization and modelling
  • Prisma - Client

Testing

Install nyc globally: npm install -g nyc Install mocha globally: npm install -g mocha

  • Run Test Code: npm test

  • Check coverage: nyc mocha test/**/*.test.js

    New Scope if necessary

  • Multer : Image Storage

  • Docker : Dockerize application: done

  • Dockerize redis server

  • Dockerize sql server

  • v1 : append v1 after /blog/{v1}/.... to test new endpoints

  • kafka : Include logs.

About

A Simple Blog Api With Nodejs and Mysql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published