# taco-bell-server

> Taco Bell Server

Latest version **1.1.0** (published 2018-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install taco-bell-server
pnpm add taco-bell-server
yarn add taco-bell-server
bun add taco-bell-server
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-04-07 |
| First published | 2017-08-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 289.5 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | bglowney |
| Maintainers | bglowney |
| Keywords | taco-bell |

## Links

- npm: https://www.npmjs.com/package/taco-bell-server
- Repository: https://github.com/bglowney/taco-bell-server
- Homepage: https://github.com/bglowney/taco-bell-server#readme
- Issues: https://github.com/bglowney/taco-bell-server/issues
- npm.io page: https://npm.io/package/taco-bell-server

## Dependencies (8)

- [co](https://npm.io/package/co.md) ^4.6.0
- [fs](https://npm.io/package/fs.md) 0.0.1-security
- [url](https://npm.io/package/url.md) ^0.11.0
- [http](https://npm.io/package/http.md) 0.0.0
- [moment](https://npm.io/package/moment.md) ^2.18.1
- [sprintf](https://npm.io/package/sprintf.md) ^0.1.5
- [taco-bell](https://npm.io/package/taco-bell.md) ^1.3.1
- [@types/mocha](https://npm.io/package/@types/mocha.md) ^5.0.0

## Recent versions

- 1.1.0 (latest) — 2018-04-07
- 1.0.4 — 2017-12-11
- 1.0.3 — 2017-08-20
- 1.0.2 — 2017-08-19
- 1.0.1 — 2017-08-19
- 1.0.0 — 2017-08-19

## README

# taco-bell-server

Utility server to support [taco-bell](https://www.npmjs.com/package/taco-bell)

## How to configure
Examples taken from [taco-bell-starter](https://www.npmjs.com/package/taco-bell-starter)

```typescript
// calling startServer(config, port = 8000) will  start an http server
// with an array of ServerHandler configuration objects
startServer([
    {
        // handle requests sent to the servlet path "/hello"
        path: '/hello',
        
        // only handle if the http method is GET
        method: 'GET',
        
        // (optional) function to check if the passed request parameters are valid
        // returning false from this function will cause the server to early return a 400 to the client
        validate: (params: HelloRequest): boolean => {
            return params != undefined && params.name.get() != undefined;
        },
        
        // put your business logic here
        handle: (params: HelloRequest): HelloResponse => {
            let o = new HelloResponse();
            o.message.set("Hello " + params.name.get() + "!");
            return o;
        },
        
        // Callback to instantiate a new request object. The request parameters will be deserialized to this object
        // This property is optional if this servlet doesn't expect any request parameters
        request: () => { return new HelloRequest(); },
        
        // Optional callback for handling any uncaught errors during validation or handling                        
        onError: (e: Error, params: HelloRequest): ServerError => {
            let error = new ServerError();
            error.message.set(e.message + ": " + params.name.get());
            return error;
        }
    }
]);

```

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