diff --git a/README.md b/README.md index 5de45199..62113b7a 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,42 @@ summaly ================================================================ -[![Greenkeeper badge](https://badges.greenkeeper.io/syuilo/summaly.svg)](https://greenkeeper.io/) - -[![][npm-badge]][npm-link] [![][mit-badge]][mit] -[![][travis-badge]][travis-link] [![][himawari-badge]][himasaku] [![][sakurako-badge]][himasaku] -[![NPM](https://nodei.co/npm/summaly.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/summaly) - -Get any web page's summary. [Try it out](https://runkit.com/npm/summaly) - Installation ---------------------------------------------------------------- -`$ npm install summaly` +``` +npm install git+https://github.com/misskey-dev/summalygit +``` Usage ---------------------------------------------------------------- -``` javascript +As a function: + +```javascript +import { summaly } from 'summaly'; + summaly(url[, opts]) ``` +As Fastify plugin: +(will listen `GET` of `/url`) + +```javascript +import Summaly from 'summaly'; + +fastify.register(Summaly[, opts]) +``` + +Run the server: + +``` +npm run build +npm run serve +``` + ### Options | Property | Type | Description | Default | @@ -43,6 +57,8 @@ interface IPlugin { A Promise of an Object that contains properties below: +※ Almost all values are nullable. player shoud not be null. + #### Root | Property | Type | Description | @@ -66,7 +82,7 @@ A Promise of an Object that contains properties below: ### Example ``` javascript -import summaly from 'summaly'; +import { summaly } from 'summaly'; const summary = await summaly('https://www.youtube.com/watch?v=NMIEAhH_fTU'); diff --git a/src/index.ts b/src/index.ts index 3c13e49a..2daa57f4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -92,7 +92,7 @@ export default function (fastify: FastifyInstance, options: Options, done: (err? url?: string; lang?: string; }; - }>('/', async (req, reply) => { + }>('/url', async (req, reply) => { const url = req.query.url as string; if (url == null) { return reply.status(400).send({