#1 set up category router

parent 5766eedd
import express, {Request, Response} from 'express';
import {model, Schema, HydratedDocument, Types} from 'mongoose';
const router = express.Router();
interface ICategory {
name: string;
description: string;
}
const Category = model<ICategory>(
'Category',
new Schema({
name: {
type: String,
required: true,
},
description: {
type: String,
required: false,
},
})
);
router.get('/', async (req: Request, res: Response) => {});
router.post('/', async (req: Request, res: Response) => {});
export {router as categoryRouter};
declare global {
namespace NodeJS {
interface ProcessEnv {
PORT: string;
MONGO_URL: string;
}
}
}
export {};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment