nknittin16436 / CausalFunnel-Coding-Assignment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Causal Assignment

Build the RestAPI for a BlogPost Application using NestJs and Sqlite3 as Databse using Typeorm. You can reset your password by using forgot password endpoint and then you will receive a Email with reset password link and then you can change your password.

Installation

$ npm install

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

PORT

JWT_SECRET

COOKIE_EXPIRE

COOKIE_NAME

MYSQL_ROOT_PASSWORD

MYSQL_DATABASE

MYSQL_LOCAL_PORT

MYSQL_DOCKER_PORT

NODE_LOCAL_PORT

NODE_DOCKER_PORT

MAILER_HOST

MAILER_PORT

MAILER_EMAIL

MAILER_PASSWORD

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

# production mode
$ npm run start:prod

API Reference

SIGNUP or Create User

  POST localhost:5000/signup
Body Type Description
name string Required. name
email string Required. email
password string Required. Password
confirmPassword string Required. confirmPassword

Login

  POST localhost:5000/login
Body Type Description
email string Required. email
password string Required. Password

FORGOT PASSWORD

  POST localhost:5000/forgot
Body Type Description
email string Required. email
user will then recieve a email for reseting the password

RESET PASSWORD

  POST http://localhost:5000/password/reset/{resetToken} (link recived in mail)
Body Type Description
password string Required. Password
confirmPassword string Required. confirmPassword

Get all blogs

  GET localhost:5000/?page=1
Query Type Description
page string Required. Page Number

Create a New Blog

  POST localhost:5000/blogs
body Type Description
title string Required. Title of Blog
description string Required. Description of Blog

Update a Blog

  PATCH localhost:5000/blogs/{blogId}
body Type Description
title string Title of blog to be Updated
description string Description of Blog

Delete a Blog

  DELETE localhost:5000/blogs/{blogId}

About


Languages

Language:TypeScript 95.4%Language:JavaScript 3.1%Language:Shell 1.5%