Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/danielsogl/marvel-api-wrapper

A simple to use Marvel API wrapper powered by Express.js and TypeScript
https://github.com/danielsogl/marvel-api-wrapper

api-wrapper express heroku marvel-api nodejs typescript

Last synced: about 1 month ago
JSON representation

A simple to use Marvel API wrapper powered by Express.js and TypeScript

Awesome Lists containing this project

README

        

# Marvel API Wrapper

[![Build Status](https://travis-ci.org/danielsogl/marvel-api-wrapper.svg?branch=master)](https://travis-ci.org/danielsogl/marvel-api-wrapper)

A simple to use Marvel API wrapper powered by [Express.js](http://expressjs.com/de/) and [TypeScript](https://www.typescriptlang.org)

![Marvel logo](https://upload.wikimedia.org/wikipedia/commons/0/04/MarvelLogo.svg 'Marvel API Wrapper')

## About

This repository allows you to use the official [Marvel API](https://developer.marvel.com) with some awesome features.

* Caching
* Simple configuration
* Only requests without another Marvel API library

And the best feature is you only need to call the API wrapper like you would call the official API. So you don't need to read two documentations.

```http
http://localhost:8080/characters
http://localhost:8080/comics
...
```

You can also add the documented URL parameters like this:

```http
http://localhost:8080/characters?nameStartsWith=S&orderBy=-name&limit=50&offset=10
```

## Setup

1. Go to the official [Marvel developers](https://developer.marvel.com) website and create a new account. After that, you will find a private and a public key inside your developer's profile page.

2. Generate a new `.env` file inside the root path of this repository and place them like this:

```text
PUBLIC_KEY=12345
PRIVATE_KEY=12345
```

3. Start the server by running the `npm run watch` command.

## Build

Because this repository is built in TypeScript you have to compile the `*.ts` files to plain JavaScript.
Run `npm run build` and the compiled `*.js` files are placed inside the `dist` folder.

## Deploy

I recommend using [Heroku](https://www.heroku.com) to deploy this repository because of nearly zero configuration and zero costs. Heroku also gives you the ability to use Redis as in-memory-database. The repository is already configured to run out of the box on Heroku.

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/danielsogl/marvel-api-wrapper)

## Test

I added basic unit tests to this repository. You find them inside the `./tests` folder. Feel free to add your own.
To run the tests just run `npm run tests`.