Hi, are you sending a JSON body in your POST request? Do any errors show up in your terminal?
If you could, show me how you are making the request, please.
Dont worry master, my bad because Im begginer and I have no installed mongoDB for that no show nothing,any error or any response, after I installed mongo all works like a charm;otherwise can you help me with other thing? please?, im trying to do this...
import Controller from './Controller';
import PostService from "./../services/PostService";
import RecordService from "./../services/RecordService";
import Post from "./../models/Post";
import Record from "./../models/Record";
const postService = new PostService(
new Post().getInstance()
);
const recordService = new RecordService(
new Record().getInstance()
);
class PostController extends Controller {
constructor(service) {
super(service);
}
async insert(req, res)
{
console.log("usando overwrite");
let response = await this.postService.insert(req.body);
console.log("creando record");
let response2 = await this.recordService.insert({"title":response.slung,"status":"created","post": response });
console.log("creado "+response2);
if (response.error) return res.status(response.statusCode).send(response);
return res.status(201).send(response);
}
}
export default new PostController(postService);
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, are you sending a JSON body in your POST request? Do any errors show up in your terminal?
If you could, show me how you are making the request, please.
Dont worry master, my bad because Im begginer and I have no installed mongoDB for that no show nothing,any error or any response, after I installed mongo all works like a charm;otherwise can you help me with other thing? please?, im trying to do this...
import Controller from './Controller';
import PostService from "./../services/PostService";
import RecordService from "./../services/RecordService";
import Post from "./../models/Post";
import Record from "./../models/Record";
const postService = new PostService(
new Post().getInstance()
);
const recordService = new RecordService(
new Record().getInstance()
);
class PostController extends Controller {
constructor(service) {
super(service);
}
async insert(req, res)
{
console.log("usando overwrite");
let response = await this.postService.insert(req.body);
console.log("creando record");
let response2 = await this.recordService.insert({"title":response.slung,"status":"created","post": response });
console.log("creado "+response2);
if (response.error) return res.status(response.statusCode).send(response);
return res.status(201).send(response);
}
}
export default new PostController(postService);