1.1.3 • Published 6 years ago

posts-escuelita v1.1.3

Weekly downloads
13
License
ISC
Repository
-
Last release
6 years ago

PostModel Escuelita data layer

This Node.js module represents the data layer of escuelita posts app. The module uses MongoDB.

API Methods

  • getById
  • create
  • update
  • read
  • delete

Usage

Initialize a PostAPI instance

const postAPI = PostAPI();  
var post: IPost = {  
    detalle: {  
        title: 'A Title',  
        categoria: 'PostModel Category',  
        descripcion: 'PostModel description',  
        linkPost: 'http://www.elpost.com/1'  
  },  
    urlImage: 'http://www.instagram.com/mgasd/1.png',  
    dateString: new Date().toDateString()  
};

Create a post

postAPI.create(post).then(value => {  
    console.log(value);  
})  
.catch(reason => {  
    console.log(reason);  
})

Delete a post

postAPI.delete('507f1f77bcf86cd799439011').then(res => {  
    console.log(res)  
}).catch(reason => console.log(reason));

Read all posts

postAPI.read().then(value => {  
    console.log(value);  
}).catch(reason => {  
    console.log(reason);  
})

Find a post by id

postAPI.getById('507f1f77bcf86cd799439011').then(value => {  
    console.log(value);  
}).catch(reason => {  
    console.log(reason);  
})

Get all post by category

postAPI.getByCategory('some-cat').then(value => {  
    console.log(value)  
}).catch(reason => {  
    console.log(reason);  
})
1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago