# auto-jsonp

> express jsonp middleware

Latest version **0.0.2** (published 2013-03-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install auto-jsonp
pnpm add auto-jsonp
yarn add auto-jsonp
bun add auto-jsonp
```

## 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.0.2 |
| Published | 2013-03-31 |
| First published | 2013-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Po-Ying Chen |
| Maintainers | poying |
| Keywords | middleware, jsonp, json |

## Links

- npm: https://www.npmjs.com/package/auto-jsonp
- Repository: https://github.com/poying/auto-jsonp
- npm.io page: https://npm.io/package/auto-jsonp

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.2 (latest) — 2013-03-31
- 0.0.1 — 2013-03-30

## README

## auto-jsonp

### 安裝
    
    npm install auto-jsonp

### 功能

* 自動把 get 多增加 .json 的網址。ex: app.get('/test') => app.get('/test'); app.get('/test.json');
* 判斷當前網址是不是 .json 結尾。
* 如果當前網址是 .json 結尾，自動把 render 改成 jsonp。

### 範例

    var jsonp = require('jsonp'); // 必須比 express 早載入
    var express = require('express');
    
    ......

    var app = express();
    app.use(jsonp);
    
    ......

    app.get('/test', function (req, res, next) {
      res.render('index', {title: 'hello'});
    });

    ......

瀏覽 http://localhost:3000/test

    hello
    Welcome to hello

瀏覽 http://localhost:3000/test.json

    {"title": "hello"}

瀏覽 http://localhost:3000/test.json?callback=define

    define({"title": "hello"});

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