Skip to content
Snippets Groups Projects
Commit e0d33218 authored by chif's avatar chif Committed by Chif Gergő
Browse files

Create first middleware with dummy data

parent d0eceeeb
Branches
No related tags found
2 merge requests!10Feature/12 dev auto deploy,!6Feature/news api
This commit is part of merge request !6. Comments created here will be created in the context of that merge request.
import { Request, Response, NextFunction } from 'express';
import { News } from '../../models/News.interface';
const getNewsListMiddleware = () => {
return (req: Request, res: Response, next: NextFunction) => {
const NewsArray: News[] = [];
NewsArray.push({
author: {
userName: 'Chif',
_id: 0,
},
title: 'Chif news',
text: 'asdasdasdasd',
publishDate: new Date(),
});
res.json({ news: NewsArray});
}
}
export default getNewsListMiddleware;
\ No newline at end of file
export interface News {
author: {
_id: Number,
userName: string,
},
editedBy?: {
_id: number,
userName: String,
},
title: string,
text: string,
publishDate: Date,
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment