Skip to content

Commit

Permalink
Merge pull request #22 from node-oauth/migrate-es-6
Browse files Browse the repository at this point in the history
4.0.0 - Migrate to async/await
  • Loading branch information
jankapunkt authored Feb 5, 2024
2 parents c58132f + fe5ec7c commit deb11f2
Show file tree
Hide file tree
Showing 53 changed files with 16,477 additions and 2,392 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github
.nyc_output
coverage
docs
node_modules
5 changes: 3 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"extends": "eslint:recommended",
"root": true,
"env": {
"node": true,
"mocha": true,
"es6": false
"es6": true
},
"parserOptions": {
"ecmaVersion": 9,
"ecmaVersion": "latest",
"sourceType": "module",
"ecmaFeatures" : {
"globalReturn": false,
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}
- run: npm ci
- run: npm run lint
- run: npm run test:coverage
- run: npm run build:docs

# with the following action we enforce PRs to have a high coverage
# and ensure, changes are tested well enough so that coverage won't fail
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 4.0.0

- bump minimal node to 16
- upgrade @node-oauth/oauth2-server to 5.1.0
- drop bluebird dependency
- upgrade all deps / dev-deps
- refactor all code to minimum es6
- use native async/await


## 3.0.0
- use @node-oauth/oauth2-server
- update all dependencies to latest
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 - Today Seegno and contributors
Copyright (c) 2015 - Today Node-OAuth contributors; Formerly: Seegno and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Complete, compliant and well tested module for implementing an OAuth2 Server/Pro

[![Tests](https://github.com/node-oauth/express-oauth-server/actions/workflows/tests.yml/badge.svg)](https://github.com/node-oauth/express-oauth-server/actions/workflows/tests.yml)
[![CodeQL](https://github.com/node-oauth/express-oauth-server/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/node-oauth/express-oauth-server/actions/workflows/github-code-scanning/codeql)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![npm Version](https://img.shields.io/npm/v/@node-oauth/express-oauth-server?label=version)](https://www.npmjs.com/package/@node-oauth/oauth2-server)
[![npm Downloads/Week](https://img.shields.io/npm/dw/@node-oauth/express-oauth-server)](https://www.npmjs.com/package/@node-oauth/oauth2-server)
![GitHub](https://img.shields.io/github/license/node-oauth/express-oauth-server)


Expand All @@ -24,11 +27,11 @@ expect the request body to be parsed already.
The following example uses `body-parser` but you may opt for an alternative library.

```js
var bodyParser = require('body-parser');
var express = require('express');
var OAuthServer = require('@node-oauth/express-oauth-server');
const bodyParser = require('body-parser');
const express = require('express');
const OAuthServer = require('@node-oauth/express-oauth-server');

var app = express();
const app = express();

app.oauth = new OAuthServer({
model: {}, // See https://github.com/node-oauth/node-oauth2-server for specification
Expand All @@ -45,21 +48,31 @@ app.use(function(req, res) {
app.listen(3000);
```

## More Examples

For more examples, please visit [our dedicated "examples" repo](https://github.com/node-oauth/node-oauth2-server-examples)
, which also contains express examples.

## Options

> Note: The following options **extend** the default options from `@node-oauth/oauth2-sever`!
> You can read more about all possible options in the
> [@node-oauth/oauth2-sever documentation](https://node-oauthoauth2-server.readthedocs.io/en/master/api/oauth2-server.html)
```
var options = {
const options = {
useErrorHandler: false,
continueMiddleware: false,
}
```
* `useErrorHandler`

- `useErrorHandler`
(_type: boolean_ default: false)

If false, an error response will be rendered by this component.
Set this value to true to allow your own express error handler to handle the error.

* `continueMiddleware`
- `continueMiddleware`
(_type: boolean default: false_)

The `authorize()` and `token()` middlewares will both render their
Expand All @@ -69,3 +82,7 @@ var options = {
**Note:** You cannot modify the response since the headers have already been sent.

`authenticate()` does not modify the response and will always call next()

## License

MIT, see
Loading

0 comments on commit deb11f2

Please sign in to comment.