I'm trying to make an api for my METEOR application. I looked at https://atmospherejs.com/simple/rest and https://atmospherejs.com/xcv58/collection-api but that didn't work. Now i'm on restivus : https://atmospherejs.com/nimble/restivus
The problem that i got is that when i'm trying to call the api, it always return my HTML template, otherwise i need a json response...
This is my code for the api =>
In server.js :
// Global API configuration
var Api = new Restivus({
apiPath: 'api/',
auth: {
token: 'auth.apiKey',
user: function () {
return {
userId: this.request.headers['user-id'],
token: this.request.headers['login-token']
};
}
},
defaultHeaders: {
'Content-Type': 'application/json'
},
onLoggedIn: function () {
console.log(this.user.username + ' (' + this.userId + ') logged in');
},
onLoggedOut: function () {
console.log(this.user.username + ' (' + this.userId + ') logged out');
},
prettyJson: true,
useDefaultAuth: true,
version: 'v1'
});
Api.addCollection('coupons');
When i try to do curl on http://localhost:3000/api/v1/login/ with some username and password data, it return me all my html template...
Someone know the solution or already have this problem ?
Thanks for your future answers :)