import { Request , Response } from "express" ; import { getManager } from "typeorm" ; import { Post } from "../entity/Post" ; /**
 * Loads post by a given id.
 */ export async function postGetByIdAction ( request , response ) { const postRepository = getManager ( ) . getRepository ( Post ) ; const post = await postRepository . findOne ( request . params . id ) ; if ( ! post ) { response . status ( 404 ) ; response . end ( ) ; return ; } response . send ( post ) ; }