Skip to content

About An application made as a project capstone for the "Kampus Merdeka x dicoding Batch 2" activity as a final requirement in the activity assessment

Notifications You must be signed in to change notification settings

Dzyfhuba/fincord-back

Repository files navigation

FINCORD BACK

About An application made as a project capstone for the "Kampus Merdeka x dicoding Batch 2" activity as a final requirement in the activity assessment

Features

  • Register
  • Login
  • Logout
  • Send Email Verification
  • Verify Email

Show NPM Features

type `npm run' to show command lists

Standard Procedure For Local Development

  1. Clone the repository
git clone https://github.com/Dzyfhuba/fincord-back.git
  1. Change directory to the cloned repository
cd fincord-back
  1. Install dependencies
npm install
  1. Run the application
npm run start
  1. Copy .env.example to .env
cp .env.example .env
  1. Change .env file to your own
  2. Create a database in your own same with .env file
  3. Migrate the database
npm run migrate

Route

Root route is /api example for register route: /api/register

/

Hello, World!

/register

POST
x-www-form-urlencoded

{
  name: String,
  username: String,
  email: Email String,
}

Success:

{
   "message": "User created successfully",
   "username": "your username",
   "email": "[email protected]",
   "token": "your token"
}

Failed 1:

{
   "error": "username or email is already used"
}

/login

POST x-www-form-urlencoded

{
  email: Email String,
  password: String
}

or

{
  username: String,
  password: String
}

Success:

{
   "message": "User logged in successfully",
   "username": "your username",
   "email": "[email protected]",
   "token": "your token"
}

Failed 1:

{
   "message": "User already logged in",
   "token": "your token"
}

/logout:

request header must contain "token".

Success:

{
   "message": "User logged out successfully"
}

Failed 1:

{
   "error": "unauthorized"
}

/sendverification

request header must contain "token".

Success:

{
   "message": "Verification email sent"
}

Failed 1:

{
   "error": "unauthorized"
}

Failed 2:

{
   "error": "user already verified"
}

/verify/:token

this route does not require /api for prefix this route is only available for unverified user.

Success:

{
   "message": "User verified"
}

Failed 1:

{
   "error": "unauthorized"
}

Failed 2:

{
   "error": "user already verified"
}

Contributors

About

About An application made as a project capstone for the "Kampus Merdeka x dicoding Batch 2" activity as a final requirement in the activity assessment

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published