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
No related branches found
No related tags found
2 merge requests!10Feature/12 dev auto deploy,!6Feature/news api
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.
Finish editing this message first!
Please register or to comment