Categorygithub.com/Croustys/blog-backend
module
0.0.0-20221125140713-895aa9b73d89
Repository: https://github.com/croustys/blog-backend.git
Documentation: pkg.go.dev

# README

Blog backend

Developed by Ákos Barabás & written in Go

For development purposes place .env file in root folder

API routes

POST

  • /login
  • /logout
  • /register
  • /create - post creation

GET

  • /user/{id}
  • /user -- returns the authenticated user's username, email
  • /posts?offset={1}&limit={1} -- optional parameters for lazy loading
  • /posts -- all posts
  • /post/{id} -- specific post
  • /ping -- just to see if the server is running properly

Technologies used

  • JWT - token based authentication
  • Bcrypt - password hashing
  • MongoDB - Document based Database

Usage

  • register
fetch("api.domain.com/register", {
  method: "POST",
  headers: {
    "Content-type": "application/json",
  },
  body: JSON.stringify({ username, email, password }),
});
  • login
fetch("api.domain.com/login", {
  method: "POST",
  headers: {
    "Content-type": "application/json",
  },
  body: JSON.stringify({ email, password }),
});
  • create post
fetch("api.domain.com/create", {
  method: "POST",
  headers: {
    "Content-type": "application/json",
  },
  body: JSON.stringify({ title, content }),
});

Hosted on Oracle

# Packages

No description provided by the author
No description provided by the author