Hiroki basic API with authentication and note management.
- Authentication using JWT
- User management with bcrypt for password hashing
- Note management (create, edit, delete)
- RESTful API endpoints using Hiroki
- Environment variable configuration
- Install dependencies:
npm install
- Development:
npm run dev
The development version includes pino-pretty
for better logging.
- Production:
npm start
Copy .env.template
to .env
and fill in all the variables.
Authenticate a user and receive a JWT.
Request body:
{
"email": "example@email.com",
"password": "your-password"
}
Response: JWT token
Get all users (requires authentication)
Create a new user (requires authentication)
Get a specific user (requires authentication)
Update a user (requires authentication)
Delete a user (requires authentication)
Get all notes (requires authentication)
Create a new note (requires authentication)
Request body:
{
"title": "Note Title",
"content": "Note Content",
"description": "Note Description"
}
Get a specific note (requires authentication)
Update a note (requires authentication)
Delete a note (requires authentication)
All private routes require Bearer authentication using the JWT obtained from the login endpoint.
Edit public routes in src/config/paths.js
- Password (hashed using bcrypt)
- Other user-related fields
{
title: String,
content: String,
description: String,
timestamps: true
}
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
This project is licensed under the MIT License