https://github.com/rorycombe/anyapi
A simple, zero config RESTful api that takes whatever you want to throw at it
https://github.com/rorycombe/anyapi
mongodb-database restify typescript
Last synced: 8 months ago
JSON representation
A simple, zero config RESTful api that takes whatever you want to throw at it
- Host: GitHub
- URL: https://github.com/rorycombe/anyapi
- Owner: RoryCombe
- License: mit
- Created: 2018-01-30T19:11:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T07:25:34.000Z (over 3 years ago)
- Last Synced: 2024-10-29T14:21:32.487Z (over 1 year ago)
- Topics: mongodb-database, restify, typescript
- Language: TypeScript
- Homepage:
- Size: 4.8 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
any API 🤖
A simple, zero config RESTful api that takes whatever you want to throw at it
---

[](https://codecov.io/gh/RoryCombe/anyapi)
## Getting Started
```
npx @anyapi/anyapi
```
or
```
npm i @anyapi/anyapi -g
anyapi
```
This will start the server on the default port of `2000`. Using any HTTP client you can now `GET`, `POST`, `PUT`, `DELETE` with a collection type that is completely variable and up to you.
For example `hamburgers`:
```
fetch('http://localhost:2000/hamburgers', {
method: 'POST',
body: JSON.stringify({ name: 'Cheese Burger', ingredients: ['beef', 'tomato', 'lettuce', 'cheese'] }),
headers: new Headers({'Content-Type': 'application/json'})
})
```
Then GET on `http://localhost:2000/hamburgers` to see your new collection
## Methods
- `GETALL` on `:collection`
- `GET` on `:collection` with `:id`
- `CREATE` on `:collection` with `:data`
- `UPDATE` on `:collection` with `:id` and `:data`
- `DESTROY` on `:collection` with `:id`