rest-easy-loki
Advanced tools
Comparing version
@@ -48,3 +48,3 @@ "use strict"; | ||
if (config.cors) { | ||
console.log('Enabling CORS.'); | ||
console.log('Enabled CORS.'); | ||
// api.use(cors({ credentials: true })); | ||
@@ -73,3 +73,3 @@ api.use(cors()); | ||
api.use(upload_service_1.uploadService(uploadPath)); | ||
console.log(`Uploading files enabled: POST to /upload/:CONTEXT and the files will be saved in ${uploadPath}.`); | ||
console.log(`Enabled file uploads: POST to /upload/:CONTEXT and the files will be saved in ${uploadPath}.`); | ||
} | ||
@@ -76,0 +76,0 @@ const router = routes_1.createRouter(ss ? ss.io : undefined); |
@@ -9,3 +9,3 @@ "use strict"; | ||
exports.createSocketService = (api) => { | ||
console.log('Enabling SOCKET.IO: subscribe to COLLECTION or COLLECTION/:ID to receive update notifications.'); | ||
console.log('Enabled SOCKET.IO: subscribe to COLLECTION or COLLECTION/:ID to receive update notifications.'); | ||
const server = http_1.default.createServer(api.callback()); | ||
@@ -12,0 +12,0 @@ // const options = cors ? { origins: '*:*'} : undefined; |
@@ -13,3 +13,3 @@ "use strict"; | ||
exports.uploadService = (uploadPath) => async (ctx, next) => { | ||
if ('POST' !== ctx.method && !/^\/upload\//.test(ctx.path)) { | ||
if (ctx.method !== 'POST' || !/^\/upload\//.test(ctx.path)) { | ||
return await next(); | ||
@@ -16,0 +16,0 @@ } |
{ | ||
"name": "rest-easy-loki", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "A REST interface for lokijs supporting CRUD operations and automatic creation of new collections.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
71333
-0.01%