server recognizes db, read/write is up

This commit is contained in:
Mikayla Dobson
2022-11-18 10:07:41 -06:00
parent f57c96a80e
commit 51a34bf0e4
7 changed files with 54 additions and 28 deletions

View File

@@ -1,4 +1,5 @@
import createError from 'http-errors';
import { IUser } from '../schemas';
import { User } from "../models/user";
const UserInstance = new User();
@@ -13,6 +14,16 @@ export default class UserCtl {
}
}
async post(data: IUser) {
try {
const response = await UserInstance.post(data);
// if (!response) throw createError(400, "Bad request");
return response;
} catch (error: any) {
throw new Error(error);
}
}
// async getOne(id: string) {
// try {
// const user = await UserInstance.getOneByID(id);