Change "messages" route to "reviews"
This commit is contained in:
parent
4367e5a944
commit
18df0a7a6a
|
@ -1,9 +1,8 @@
|
|||
import { PostListener } from "./routes";
|
||||
import { PostListener, MessagesResponder } from "./routes";
|
||||
import express from "express";
|
||||
import dotenv from "dotenv";
|
||||
import { checkFile, emp, Logger } from "./utils";
|
||||
import { ReviewData } from "./utils/ReviewData";
|
||||
import { MessagesResponder } from "./routes/messages";
|
||||
dotenv.config();
|
||||
|
||||
const app = express();
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
export * from "./post";
|
||||
export * from "./reviews";
|
||||
|
|
|
@ -11,18 +11,18 @@ export class MessagesResponder {
|
|||
}
|
||||
|
||||
public async start(): Promise<void> {
|
||||
this.server.get("/messages", (req: Request, res: Response) => {
|
||||
this.server.get("/reviews", (req: Request, res: Response) => {
|
||||
const result = data.getReviews();
|
||||
|
||||
res.writeHead(!result.toString() ? 200 : 204, typeJson);
|
||||
res.writeHead(200, typeJson);
|
||||
res.write(JSON.stringify(result));
|
||||
res.end();
|
||||
});
|
||||
|
||||
this.server.get("/messages/:id", (req: Request, res: Response) => {
|
||||
this.server.get("/reviews/:id", (req: Request, res: Response) => {
|
||||
const result = data.getReviewById(req.params.id);
|
||||
|
||||
res.writeHead(!result.toString() ? 200 : 204, typeJson);
|
||||
res.writeHead(200, typeJson);
|
||||
res.write(JSON.stringify(result));
|
||||
res.end();
|
||||
})
|
Loading…
Reference in a new issue