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
- Register
- Login
- Logout
- Send Email Verification
- Verify Email
type `npm run' to show command lists
- Clone the repository
git clone https://github.com/Dzyfhuba/fincord-back.git
- Change directory to the cloned repository
cd fincord-back
- Install dependencies
npm install
- Run the application
npm run start
- Copy .env.example to .env
cp .env.example .env
- Change .env file to your own
- Create a database in your own same with .env file
- Migrate the database
npm run migrate
Root route is /api example for register route: /api/register
Hello, World!
POST
x-www-form-urlencoded{ name: String, username: String, email: Email String, }
Success:
{ "message": "User created successfully", "username": "your username", "email": "ur@mail.com", "token": "your token" }Failed 1:
{ "error": "username or email is already used" }
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": "ur@mail.com", "token": "your token" }Failed 1:
{ "message": "User already logged in", "token": "your token" }
request header must contain "token".
Success:
{ "message": "User logged out successfully" }Failed 1:
{ "error": "unauthorized" }
request header must contain "token".
Success:
{ "message": "Verification email sent" }Failed 1:
{ "error": "unauthorized" }Failed 2:
{ "error": "user already verified" }
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" }