Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vibhorgupta-gh/shinigami

A boilerplate stateless microservice built with Node.js
https://github.com/vibhorgupta-gh/shinigami

Last synced: about 2 months ago
JSON representation

A boilerplate stateless microservice built with Node.js

Awesome Lists containing this project

README

        

## Shinigami
A stateless microservice built with Node.js

#### Functionalities
- Login stateless users
- Patch JSON objects
- Download images and return 50x50 thumbnails

#### APIs

- `/login`
- method: `POST`
- request body:
```
{
username: ,
password:
}
```
- response object:
```
{
msg: "success",
value: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InNoaW5pZ2FtaSIsImlhdCI6MTU0OTk1NzE4NCwiZXhwIjoxNTQ5OTU3MjA0fQ.187znPAxy6mrfqXqWiKINWxAobsWNMWjSP2mBBUlGs8"
}
```

- `/patch`
- method: `POST`
- request body:
```
{
object: {"foo": "bar"},
patch: [{"op": "add", "path": "/baz", "value": "boo"}]
}

```
- response object:
```
{
msg: "success",
value: {
"foo": "bar",
"baz": "boo"
}
}
```

- `/thumbnail`
- method: `POST`
- request body:
```
{
url:
}

```
- response object:
```
{
msg: "success",
value: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsSAAALEgHS3X78"
}
```

#### Usage

- For utilising the `/login` endpoint, you need to send content headers like so:
```
Content-Type: application/json
```
- For utilising the `/patch` and `/thumbnail` endpoint, you need to send content headers and the authorization header. The token value is that obtained from the response object of the `/login` endpoint, like so:
```
Content-Type: application/json
Authorization: Bearer
```

#### Installation and Setup

- To install the dependencies, navigate to project root and `npm install`.

- To run the server, `npm run start`

#### Testing

- The application is fully unit tested and integration tested. To run tests, run `npm run test`.

- Ensure that you do not already have a process running on port `4000` of your localhost. If you do, kill that process using `kill -9 `.

- To generate a code coverage report, `npm run test:report`. This project uses [nyc](https://www.npmjs.com/package/nyc) for codecov. `nyc` is a beautiful package recommended by `istanbul` itself.

- To run syntax and linting tests, run `npm run lint`. This project uses `eslint` for linting standards.