cat data mocking
This commit is contained in:
84
catDataMocking/src/app.model.ts
Normal file
84
catDataMocking/src/app.model.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
export type CatType = {
|
||||
id: string;
|
||||
|
||||
name: string;
|
||||
|
||||
age: number;
|
||||
|
||||
species: string;
|
||||
|
||||
isCute: boolean;
|
||||
|
||||
friends: string[];
|
||||
};
|
||||
|
||||
export const Cat: CatType[] = [
|
||||
{
|
||||
id: "fsduifh",
|
||||
name: "blue",
|
||||
|
||||
age: 8,
|
||||
|
||||
species: "Russian Blue",
|
||||
|
||||
isCute: true,
|
||||
|
||||
friends: ["asdfhj29009", "WE09tju2j"],
|
||||
},
|
||||
|
||||
{
|
||||
id: "iohf2309q4hr",
|
||||
|
||||
name: "som",
|
||||
|
||||
age: 4,
|
||||
|
||||
species: "Sphynx cat",
|
||||
|
||||
isCute: true,
|
||||
|
||||
friends: ["weju0fj20qj", "asdfhj29009", "weju0fj20qj"],
|
||||
},
|
||||
|
||||
{
|
||||
id: "WE09tju2j",
|
||||
|
||||
name: "lean",
|
||||
|
||||
age: 6,
|
||||
|
||||
species: "Munchkin",
|
||||
|
||||
isCute: false,
|
||||
|
||||
friends: [],
|
||||
},
|
||||
|
||||
{
|
||||
id: "asdfhj29009",
|
||||
|
||||
name: "star",
|
||||
|
||||
age: 10,
|
||||
|
||||
species: "Scottish Fold",
|
||||
|
||||
isCute: true,
|
||||
|
||||
friends: ["weju0fj20qj"],
|
||||
},
|
||||
|
||||
{
|
||||
id: "weju0fj20qj",
|
||||
|
||||
name: "red",
|
||||
|
||||
age: 2,
|
||||
|
||||
species: "Sharm",
|
||||
|
||||
isCute: false,
|
||||
|
||||
friends: [],
|
||||
},
|
||||
];
|
18
catDataMocking/src/app.ts
Normal file
18
catDataMocking/src/app.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as express from "express";
|
||||
import * as cors from "cors";
|
||||
|
||||
import { CatType, Cat } from "./app.model";
|
||||
|
||||
const app: express.Express = express();
|
||||
const port: number = 8000;
|
||||
|
||||
app.use(cors());
|
||||
|
||||
app.get("/", (req: express.Request, res: express.Response) => {
|
||||
console.log(req);
|
||||
res.send({ cats: Cat });
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`server is on ${port}`);
|
||||
});
|
Reference in New Issue
Block a user