https://github.com/marlo22/mime-api
Simple REST API to searching MIME types.
https://github.com/marlo22/mime-api
api express mime mime-type mime-types node nodejs rest rest-api restful sqlite type
Last synced: 3 months ago
JSON representation
Simple REST API to searching MIME types.
- Host: GitHub
- URL: https://github.com/marlo22/mime-api
- Owner: marlo22
- License: mit
- Created: 2019-12-01T15:51:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T15:32:53.000Z (over 3 years ago)
- Last Synced: 2026-01-03T16:22:40.853Z (6 months ago)
- Topics: api, express, mime, mime-type, mime-types, node, nodejs, rest, rest-api, restful, sqlite, type
- Language: JavaScript
- Size: 350 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mime-api
Simple REST API to searching MIME types.
## About
This API is created in Node.js - using Express.js framework and SQLite database.
## How to run it?
First, you should clone this repository, then install all required dependencies by using `npm install` or `yarn install`. If all packages will be installed run server by `npm start` or `yarn start`. By default API should be exposed on port 3000. You can change it by defining your `.env` file with `PORT={YOUR_NUMBER}` entry.
## Using API
API provides two routes - to getting MIME types by extensions and conversely - to getting extensions by MIME types.
### GET {url}/mime
Return all extensions with assign corresponding MIME type.
```js
{
...
"jpg": "image/jpeg",
"jpeg": "image/jpeg",
"png": "image/png",
"gif": "image/gif"
...
}
```
### GET {url}/mime?ext=jpg,png
Return specified extensions with assign corresponding MIME type.
```js
{
"jpg": "image/jpeg",
"png": "image/png"
}
```
### GET {url}/ext
Return all MIME types with assign corresponding extensions.
```js
{
...
"image/jpeg": [
"jpg",
"jpeg"
],
"image/png": [
"png"
],
"image/gif": [
"gif"
]
...
}
```
### GET {url}/ext?mime=image/jpeg,image/png
Return specified MIME types with assign corresponding extensions.
```js
{
"image/jpeg": [
"jpg",
"jpeg"
],
"image/png": [
"png"
]
}
```
## Source
List of MIME types based on [MDN article](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types).
## License
MIT