@coderom/medium-blog
v1.1.1
Published
A simple TypeScript package providing input validation for a Medium-like blog platform using Zod.
Downloads
26
Readme
A simple TypeScript package providing input validation for a Medium-like blog platform using Zod.
Features
- Signup validation
- Signin validation
- Blog Creation validation
- Blog Update validation
- TypeScript support for all schemas
Installation
npm i @coderom/medium-blog
Usage
Import Schemas and Types
import { signupInput, signinInput, createBlogInput, updateBlogInput } from '@coderom/medium-blog';
Example Validation
Signup
const result = signupInput.safeParse({
username: "[email protected]",
password: "password123",
name: "John Doe"
});
if (!result.success) {
console.log(result.error);
}
Blog Creation
const result = createBlogInput.safeParse({
title: "My Blog",
content: "This is the blog content."
});
if (!result.success) {
console.log(result.error);
}
Types
You can also import the inferred TypeScript types:
import { SignupInput, CreateBlogInput } from '@coderom/medium-blog';