# can-make-rest

> Make restful urls and methods from a resource

Latest version **0.1.4** (published 2019-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install can-make-rest
pnpm add can-make-rest
yarn add can-make-rest
bun add can-make-rest
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2019-08-21 |
| First published | 2017-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Bitovi |
| Maintainers | cherif_b, christopherjbaker, justinbmeyer, phillipskevin |
| Keywords | donejs, donejs-plugin |

## Links

- npm: https://www.npmjs.com/package/can-make-rest
- Repository: https://github.com/canjs/can-make-rest
- Homepage: http://canjs.com
- Issues: https://github.com/canjs/can-make-rest/issues
- npm.io page: https://npm.io/package/can-make-rest

## Dependencies (1)

- [can-reflect](https://npm.io/package/can-reflect.md) ^1.0.0

## Recent versions

- 0.1.4 (latest) — 2019-08-21
- 1.0.0-0 (pre) — 2019-08-21
- 0.1.5-0 — 2019-08-21
- 0.1.3 — 2018-02-16
- 0.1.2 — 2017-09-24
- 0.1.1 — 2017-06-23
- 0.1.0 — 2017-06-23
- 0.1.0-pre.0 — 2017-06-14
- 0.0.2 — 2017-06-02
- 0.0.1 — 2017-06-02

## README

# can-make-rest

[![Build Status](https://travis-ci.org/canjs/can-make-rest.png?branch=master)](https://travis-ci.org/canjs/can-make-rest) [![Greenkeeper badge](https://badges.greenkeeper.io/canjs/can-make-rest.svg)](https://greenkeeper.io/)

Make restful urls and methods from a resource.  

## `makeRest( resourceUrl[, uniqueProperty])`


Provide it an "items" resource url and the unique property name and it returns an object with
CRUD HTTP methods and templated urls.

```js
makeRest( "/todos", "ID" ); //=> {
//    getData: {method:"GET", url: "/todos/{ID}"},
//    getListData: {method:"GET", url: "/todos"},
//    createData: {method:"POST", url: "/todos"},
//    updateData: {method:"PUT", url: "/todos/{ID}"},
//    destroyData: {method:"DELETE", url: "/todos/{ID}"}
//  }
```

If a templated "item" resource URL is provided, it will be able to infer the unique property name.

```js
makeRest( "/todos/{_id}" ); //=> {
//    getData: {method:"GET", url: "/todos/{_id}"},
//    getListData: {method:"GET", url: "/todos"},
//    createData: {method:"POST", url: "/todos"},
//    updateData: {method:"PUT", url: "/todos/{_id}"},
//    destroyData: {method:"DELETE", url: "/todos/{_id}"}
//  }
```

---
_Source: https://npm.io/package/can-make-rest · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
