# turall

> Express and mongoose token authentication library

Latest version **0.0.1** (published 2016-12-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install turall
pnpm add turall
yarn add turall
bun add turall
```

## 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.1 |
| Published | 2016-12-27 |
| First published | 2016-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+11 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Rahul Bhola |
| Maintainers | georoot |
| Keywords | express, mongoose, token, auth |

## Links

- npm: https://www.npmjs.com/package/turall
- Repository: https://github.com/georoot/express-token-auth
- Homepage: https://github.com/georoot/express-token-auth#readme
- Issues: https://github.com/georoot/express-token-auth/issues
- npm.io page: https://npm.io/package/turall

## Dependencies (6)

- [bcrypt](https://npm.io/package/bcrypt.md) ^1.0.1
- [express](https://npm.io/package/express.md) ^4.14.0
- [mongoose](https://npm.io/package/mongoose.md) ^4.7.5
- [body-parser](https://npm.io/package/body-parser.md) ^1.15.2
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^7.2.1
- [mongoose-type-email](https://npm.io/package/mongoose-type-email.md) ^1.0.2

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2016-12-27

## README

# turall

Library to just create `token authentication` in `expressJs` faster. This is inspired by my personal needs to not have to write the same routes and models every time for a new project.

## Usage

Installation is as simple as

`npm install --save turall`

You can startoff by writing simple express application as follows

```
var express    = require('express');
var mongoose   = require('mongoose');
var bodyParser = require('body-parser');
var turall     = require('turall');

var app = express();
// You can write code to connect to mongoose here

// This is needed to encode the jwt token
app.set("secret",<Super secret>);

// This will handle auto decoding of tokens
app.use(turall.authMiddleware);

// Define all routes for authentication
app.use("/auth",turall.routes);

// Finally create protected resource
app.get('/',turall.protect,function(req,res,next){
  // req.user contains info about logged in user
  res.json(req.user);
});
```


## Creating a new user

You can create new user by posting email and password to `/auth` route from the example above. Response code is `200` for valid and `400` for invalid data.

## Authenticating user

For authentication simply post to `/auth/authenticate` in the example above. You will get a valid json with `token` as key if the credentials are a match.


## Roadmap

This is the first release and there is a lot of room for improvements. The following are the stuff i would like to work on in near future on this Library

- [ ] Add integration for custom models
- [ ] Add user mail validation
- [ ] Add `sudo` capabilities
- [ ] Better middleware

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