Skip to content

Commit

Permalink
README Update: package usage
Browse files Browse the repository at this point in the history
ref #13
  • Loading branch information
philippdormann committed Jun 28, 2021
1 parent 6809385 commit 52bb3e4
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,38 @@
🍲🥘🥡🍛🍜🦐🥔
</pre>

[![Deployment](https://badgen.net/badge/Deployment⚡/Vercel/black)](https://mensa.vercel.app) [![donate with PayPal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://paypal.me/philippdormann) [![buy me a coffee](https://img.shields.io/badge/buymeacoffee-donate-yellow.svg)](https://buymeacoffee.com/philippdormann) [![ko-fi](https://badgen.net/badge/ko-fi/donate/yellow)](https://ko-fi.com/V7V4I6I8)
[![Deployment](https://badgen.net/badge/Deployment/Vercel/black)](https://mensa.vercel.app) [![donate with PayPal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://paypal.me/philippdormann) [![buy me a coffee](https://img.shields.io/badge/buymeacoffee-donate-yellow.svg)](https://buymeacoffee.com/philippdormann) [![ko-fi](https://badgen.net/badge/ko-fi/donate/yellow)](https://ko-fi.com/V7V4I6I8)

## 🧐 Usage
> General Note: Please use your own caching strategy, MensaMax servers might be quite slow
### API usage
see <https://mensa.vercel.app/institutions-ui> for API URLs

### npm package usage
#### Install package
```bash
yarn add @philippdormann/mensamax-api
```
#### ts/ module imports
```ts
import { fetcher, parser } from '@philippdormann/mensamax-api';
const html = await fetcher({ p: 'FO111', e: 'herz' });
const parsed = await parser(html);
console.log(parsed);
```
#### CommonJS imports
```js
const { fetcher, parser } = require('@philippdormann/mensamax-api');
(async function() {
try {
const html = await fetcher({ p: 'FO111', e: 'herz' });
const parsed = await parser(html);
console.log(parsed);
} catch (e) {
console.log(e);
}
})();
```

## 🚀 Deployment
This project is deployed as a serverless function on the url <https://mensa.vercel.app> with [Vercel](https://vercel.com/) ☁️
Expand All @@ -20,7 +51,8 @@ To do so, just run this code:
docker-compose up -d --build
```

## 💻 Local Development with Express Server
## 💻 Local Development
Either develop on your machine directly or use the provided devcontainer for VSCode
```
yarn && yarn dev
```
Expand Down

0 comments on commit 52bb3e4

Please sign in to comment.