I’m fairly new to MeteorJS, so please bear in mind that I do not have much experience.
I’ve come here after unsuccessfully trying to make my MeteorJS application be able to take GET and POST requests. Hopefully I will have better luck here.
Basically, every time I make a GET or POST call (using curl, a Ruby script, and REST Console) I get the HTML code of a blank page back that has full tags but an empty tag. It happens regardless the package that I use (I tried Restivus and Picker).
I posted a more detailed question (with example code) in Stackoverflow, if you need more details.
Has anyone face the same issue before? If so, how did you approach it?
I am open to use another package, but that does not seem to be the issue.
First, I see that you have the route.js file in the path server/route/, is that important? Can in be in lib folder?
Second, what is the need of /:id? At no point does the route use id, and for me, it seemed to ignore the routes where I specified :message. It instead went for the route where I only typed Router.route('/newReport/', {where: 'server}).
Third, what is the use of {where: 'server'} if our router file is already in the server folder?
Sure, route.js could be in lib. I would put the router_config.js file in there as well though. It basically just need to be parsed before the route is called.
:id params are not needed I just wanted to show how you can use the id if you’re fetching a report by id. If you’re using REST then it would be something like GET /reports/1234. If you want it to be optional put a question mark after it like /reports/:id?
You need to specify the where or you’ll end up pulling down the client HTML. Even though it’s in the server file it still thinks it’s a clientside route.
Also you mentioned using /newReport, this works just fine but if you want to stick to REST conventions using a POST /reports/new and then passing in form data for the content is the way to go. Saying that you’ve prob. noticed that my POST call has params 123… this isn’t needed as the report doesn’t exist yet. I meant to use PUT in my example above. Oh well!
However at any rate using newReport works just fine!
Yea def. check that package out @sammyis … IR is ok but i’m mainly using it for legacy special case reasons. meteor-rest seems like a much easier way to go (or simple-json at the least).