Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nodecaf

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodecaf - npm Package Compare versions

Comparing version 0.7.5 to 0.7.6

6

CHANGELOG.md

@@ -8,2 +8,7 @@ # Nodecaf Changelog

## [v0.7.6] - 2019-07-24
### Added
- setting to permissively allow CORS on all routes
## [v0.7.5] - 2019-07-23

@@ -191,1 +196,2 @@

[v0.7.5]: https://gitlab.com/GCSBOSS/nodecaf/-/tags/v0.7.5
[v0.7.6]: https://gitlab.com/GCSBOSS/nodecaf/-/tags/v0.7.6

3

lib/app-server.js
const os = require('os');
const fs = require('fs');
const cors = require('cors');
const http = require('http');

@@ -93,2 +94,4 @@ const https = require('https');

this.express.use(compression());
if(this.settings.cors)
this.express.use(cors());
this.express.use(logRequest.bind(this));

@@ -95,0 +98,0 @@ callback.bind(this)(this.routerFuncs);

3

package.json
{
"name": "nodecaf",
"version": "0.7.5",
"version": "0.7.6",
"description": "Nodecaf is an Express framework for developing REST APIs in a quick and convenient manner.",

@@ -41,2 +41,3 @@ "main": "lib/main.js",

"compression": "^1.7.4",
"cors": "^2.8.5",
"eclipt": "^0.1.2",

@@ -43,0 +44,0 @@ "ejs": "^2.6.2",

@@ -17,2 +17,3 @@ # [Nodecaf](https://gitlab.com/GCSBOSS/nodecaf)

database connections).
- Shortcut for [permissive CORS](#cors) on all routes.
- [HTTPS capability](#https).

@@ -386,2 +387,11 @@ - Functions to [describe your API](#api-description) making your code the main

### CORS
Nodecaf provides a setting to enable permissive CORS on all routes. Defaults to
disabled. In your conf file:
```js
cors = true
```
### HTTPS

@@ -388,0 +398,0 @@

@@ -464,2 +464,21 @@ //const wtf = require('wtfnode');

describe('CORS', () => {
it('Should send permissive CORS headers when setup so [cors]', async () => {
let app = new AppServer();
app.settings.cors = true;
app.api(function({ get }){
get('/foobar', ({ res }) => res.end() );
});
await app.start();
const { assert } = await base.get('foobar', { 'Origin': 'http://outsider.com' });
assert.status.is(200);
assert.headers.match('access-control-allow-origin', '*');
const { assert: { headers } } = await base.options('foobar', { 'Origin': 'http://outsider.com' });
headers.match('access-control-allow-methods', 'GET,HEAD,PUT,PATCH,POST,DELETE');
await app.stop();
});
});
describe('Accept setter', () => {

@@ -466,0 +485,0 @@ const { accept } = require('../lib/parse-types');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc