|
1 | | -# petstore-component-nodejs |
2 | | -> Petstore Node.js component template for the [elastic.io platform](http://www.elastic.io "elastic.io platform") |
| 1 | +# Petstore Component Node.js |
3 | 2 |
|
4 | | -This is a component template which we commonly refer as **the first step of the development** for creating a component to deploy into our platform. This component comes with a basic architecture which can be used on our platform. You can clone it and use it. However, **if you plan to deploy it into [elastic.io platform](https://www.elastic.io "elastic.io platform") you must follow sets of instructions to succeed**. |
| 3 | +## Description |
5 | 4 |
|
6 | | -## Before you Begin |
| 5 | +A fully working and operational component template to use for starting development of your |
| 6 | +own component for the [elastic.io platform](http://www.elastic.io "elastic.io platform"). |
| 7 | +This component comes with a basic architecture which you can use on the platform. |
7 | 8 |
|
8 | | -Before you can deploy any code into our system **you must be a registered elastic.io platform user**. Please see our home page at [https://www.elastic.io](https://www.elastic.io) to learn how. |
| 9 | +The component interacts with the [petstore sample server](https://petstore.elastic.io/docs/). |
9 | 10 |
|
10 | | -> Any attempt to deploy a code into our platform without a registration would be rejected. |
| 11 | +Our documentation on [building components in nodejs](https://docs.elastic.io/guides/building-nodejs-component) |
| 12 | +has more about each including file and their function. |
11 | 13 |
|
12 | | -After the registration and opening of the account you must **[upload your SSH Key](http://go2.elastic.io/manage-ssh-keys)** into our platform. |
| 14 | +## Requirements |
13 | 15 |
|
14 | | -> If you fail to upload you SSH Key you will get **permission denied** error during the deployment. |
| 16 | +To use this component you must be registered platform user. Please see our home |
| 17 | +page at [https://www.elastic.io](https://www.elastic.io) to learn how to register. |
15 | 18 |
|
16 | | -## Getting Started |
| 19 | +### Authentication |
17 | 20 |
|
18 | | -After registration and uploading of your SSH Key you can proceed to deploy it into our system. At this stage we suggest you to: |
19 | | -* [Create a team](http://go2.elastic.io/manage-teams) to work on your new component. This is not required but will be automatically created using random naming by our system so we suggest you name your team accordingly. |
20 | | -* [Create a repository](http://go2.elastic.io/manage-repositories) where your new component is going to *reside* inside the team that you have just created. |
| 21 | +To authenticate use `secret` as an API key. For more details see the |
| 22 | +[Petstore API docs](https://petstore.elastic.io/docs/). |
21 | 23 |
|
22 | | -```bash |
23 | | -$ git clone https://github.com/elasticio/petstore-component-nodejs.git your-repository |
| 24 | +## Triggers |
24 | 25 |
|
25 | | -$ cd your-repository |
26 | | -``` |
27 | | -Now you can edit your version of **petstore-component-nodejs** component and build your desired component. Or you can just ``PUSH``it into our system to see the process in action: |
| 26 | +### Get Pets By Status |
28 | 27 |
|
29 | | -```bash |
30 | | -$ git remote add elasticio your-team@git.elastic.io:your-repository.git |
| 28 | +Retrieves pets from the Petstore API by given pet status using Dynamic or Static |
| 29 | +Data Sample. The difference is how these functions are made. However, both can have |
| 30 | +the following statuses defined by the Petstore API: |
31 | 31 |
|
32 | | -$ git push elasticio master |
33 | | -``` |
34 | | -Obviously the naming of your team and repository is entirely up-to you and if you do not put any corresponding naming our system will auto generate it for you but the naming might not entirely correspond to your project requirements. |
| 32 | +* `Available` - select to get all pets with status `Available`. |
| 33 | +* `Pending` - select for `Pending`. |
| 34 | +* `Sold` - select for `Sold`. |
| 35 | + |
| 36 | + |
| 37 | +## Actions |
| 38 | + |
| 39 | +### Creates a new pet |
| 40 | + |
| 41 | +Creates a new Pet by making a `POST` to `/pet` endpoint of the API. The input |
| 42 | +fields are: |
| 43 | + |
| 44 | +* `petId` (required) - the Id of the pet. |
| 45 | +* `name` - the name of the pet. |
| 46 | +* `status` - the status which can have one `Available`, `Pending` and `Sold` values. |
35 | 47 |
|
36 | 48 | ## File Structure |
37 | 49 |
|
38 | | -The structure of **petstore-component-nodejs** component is quite flexible. [elastic.io platform](https://www.elastic.io) expects only two files to be present in the main directory. These are the ``component.json`` and ``package.json``. Our documentation on [how to build a component in node.js](https://support.elastic.io/support/solutions/articles/14000027123-how-to-build-a-component-in-node-js) has more about each file and their function. |
| 50 | +The structure of **petstore-component-nodejs** component is quite flexible. |
| 51 | +[elastic.io platform](https://www.elastic.io) expects only two files to be present |
| 52 | +in the main directory. These are the ``component.json`` and ``package.json``. Our |
| 53 | +documentation on [how to build a component in node.js](https://docs.elastic.io/guides/building-nodejs-component) |
| 54 | +has more about each file and their function. |
0 commit comments