Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 1.27 KB

README.md

File metadata and controls

60 lines (43 loc) · 1.27 KB

Next.js blog.

Next.js with Typescript, Firebase database and Next auth.

Main goal -> build fullstack app.

Features ->

  1. Auth/login.
  2. Send message without login.
  3. Create a post with login.

Alt Text Alt Text Alt Text


A piece of code

import { hash, compare } from 'bcryptjs';
import { User } from '../pages/api/auth/signup';

export const hashPassword = async (password: string) => {
  const hashedPassword = await hash(password, 12);
  return hashedPassword;
};

export const signUpHelper = async (user: User) => {
  await fetch('/api/auth/signup', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(user),
  });
};

export const verifyPassword = async (password: string, hashedPassword: string) => {
  const isValid = await compare(password, hashedPassword);
  return isValid;
};

Download & Installation

git clone https://github.com/cold-world/nextjs-blog.git
cd <project-dir>
npm install
npm run dev