This is the backend of a simple blogging application built with TypeScript using the Hono framework and Prisma ORM. The backend provides APIs for managing users, posts, and tags.
Backend hosted on cloudflare: Access here
- GET /users: Get all users.
- POST /users/signup: Sign up a new user.
- POST /users/login: Log in an existing user.
- GET /posts/all-posts: Get all posts.
- GET /posts/user-posts: Get posts created by the authenticated user.
- GET /posts/get-post/:id: Get a specific post by ID.
- POST /posts/create-post: Create a new post.
- PUT /posts/update-post/:id: Update an existing post.
- DELETE /posts/delete-post/:id: Delete a post.
- GET /tags/all-tags: Get all tags.
- POST /tags/create-tag: Create a new tag.
- PUT /tags/update-tag/:id: Update an existing tag.
- DELETE /tags/delete-tag/:id: Delete a tag.
- authMiddleware: Middleware to authenticate requests using JWT token.
- postController: Contains functions to handle post-related logic. ##Database
- Uses Prisma ORM for database operations.
- Supports PostgreSQL database.
- Hono: Lightweight web framework for TypeScript.
- Prisma: Modern database toolkit for Node.js and TypeScript.
- jsonwebtoken: JSON Web Token implementation for node.js.
- Zod: TypeScript-first schema validation with static type inference.
- DATABASE_URL: URL of the PostgreSQL database.
- JWT_PASSWORD: Secret key for JWT token encryption. ##Usage
- Make sure the server is running.
- Use tools like Postman or curl to send requests to the API endpoints.
- Authenticate users using JWT tokens.
- Create, read, update, and delete posts and tags as needed.