https://github.com/codeekage/backend-microservice
Dockerized version
https://github.com/codeekage/backend-microservice
Last synced: 29 days ago
JSON representation
Dockerized version
- Host: GitHub
- URL: https://github.com/codeekage/backend-microservice
- Owner: codeekage
- License: apache-2.0
- Created: 2018-04-30T10:44:51.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T12:38:09.000Z (about 8 years ago)
- Last Synced: 2025-04-27T11:02:37.898Z (about 1 year ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# backend-microservice
Dockerized version
## Getting Started
Simple backend task for Hackerbay, before making any request please ensure you have PostMan installed. GET POSTMAN [HERE](https://www.getpostman.com/apps).
New to POSTMAN ? SEE [DOCS](https://www.getpostman.com/docs/v6/)
### Table of contact
* Login
* Contact Patch
* Thumbnail Generator
### Login
To get started with the login service make a request to `localhost:4000/login` this is the public route from running docker.
Make sure that the Request Body contians `username` and `password`. Should look this way
```
{
"username" : "Username",
"password" : "Password"
}
```
The request returns a `jwt token` that must be added to the Header to access Procted Routes. See Adding Bearer Token HERE
Awesome! you just got your `jwt token` and you can proceed to procted routes like `/contacts` and `/thumbnail`.
### Contacts
Now you've gotten your `jwt token` and must have added it to the `Bearer ` Make a `GET` request to `localhost:4000/contacts`, Done? Awesome! this retrieves the pervious added contacts in a `json format`.
With the same header Authorization and Bearer make a `POST` request to `localhost:4000/contacts` to add a new contact. Requet body should look.
```
{
"name" : "Nazas",
"tel" : "555-555-555",
"email" : "interview@hackerbay.io"
}
```
Awesome! we've made fast progress so far. Making a `PUT` and `DELETE` request will require an addition params i.e `/:index` this matches the request to particular index of the array of the `JSON` Data. Your request should be `localhost:4000/contacts/1` this matched our request to the index of `1` if we make a `PUT` a request to that `URL` it updates that portion of the `JSON PATCH`. Try it yourself. This goes with the `DELETE` request to that `URL` or `route` it removes that `index` from the `JSON PATCH`.
### Thumbnail Generator
NB:- _node-thumbnail creates a queue of images and converts them asynchronously into thumbnails. node-thumbnail has no binary dependencies --- only javascript._
Because the route `localhost:4000/thumbnail` you will defintely need to add our to the Authorization Header. Selecting an image should generate a thumbnail. Try doing this in your browser.