Skip to content

boluajileye/blog_with_auth_node

Repository files navigation

Blog with AAuthentication Using Adonis Js

Steps to Use

  1. Clone the Repository
  2. CD into the desired project folder
  3. Install all projects dependencies using npm install..
  4. Copy the content of .env.example and create a .envand paste the content
  5. Run node ace migration:run to create database tables on the database
  6. Start backend server locally.. node ace serve --watch. This should startup a local server @ `http://127.0.0.1:3333

make sure MYSQL server has started locally before running the above commands.

Endpoints.

Register User

POST

http://127.0.0.1:3333/regsiter

PAYLOAD DATA

{
    "username": "testuser",
    "firstname": "testuser",
    "lastname": "testuser",
    "role_type": "user",
    "email": "test@gmail.com",
    "password": "password"
}

Login User

POST

http://127.0.0.1:3333/login

PAYLOAD DATA

{
    "email": "test@gmail.com",
    "password": "password"
}

Logout User

POST

http://127.0.0.1:3333/logout

Get post by username

GET

http://127.0.0.1:3333/posts/:USERNAME

Get all post

GET

http://127.0.0.1:3333/posts

Get post by ID

GET

http://127.0.0.1:3333/posts/:ID

Create Post

POST

http://127.0.0.1:3333/posts

PAYLOAD DATA

{
    "title": "First blog post",
    "content": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.."
}

Update Post by post ID

PUT

http://127.0.0.1:3333/posts/:ID

PAYLOAD DATA

{
    "title": "First blog post",
    "content": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.."
}

Delete Post by post ID

DELETE

http://127.0.0.1:3333/posts/:ID

If an error occur while migrating, cross check the **.env** file and make sure you passed the correct database informations Allow add bearer token for authentication after login

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published