so my current configuration is as follows:
I'm using a context array in order to group multiple paths to the same target
const TARGET_URL1 = 'https://target-url-1.xyz';
const PROXY_CONFIG = [
{
context: [
'/api/link1',
'/api/link2',
],
target: TARGET_URL1,
secure: false,
changeOrigin: true,
ws: true,
},
];
But right now, I need a new target for a new context path and I can't find any example on how to implement while keeping the context.
The correct way of implementation is to duplicate the whole object and change your context and targets:
const TARGET_URL1 = 'https://target-url-1.xyz';
const TARGET_URL2 = 'https://target-url-2.xyz';
const PROXY_CONFIG = [
{
context: [
'/api/link1',
'/api/link2',
],
target: TARGET_URL1,
secure: false,
changeOrigin: true,
ws: true,
},
{
context: [
'/api/new-different-link',
],
target: TARGET_URL2,
secure: false,
changeOrigin: true,
},
];
Related
Source code from Cypress on Rails
// spec/cypress/support/on-rails.ts
Cypress.Commands.add('app', function (name, command_options) {
return cy
.appCommands({ name: name, options: command_options })
.then((body) => {
return body[0];
});
});
spec/cypress/tsconfig.json
{
"compilerOptions": {
"strict": true,
"target": "es5",
"lib": ["es6", "dom"],
"module": "es6",
"moduleResolution": "node",
"sourceMap": false,
"types": ["cypress"],
"downlevelIteration": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"include": ["**/*.ts"]
}
Results in
Property 'app' does not exist on type 'cy & EventEmitter'.
Rather old, but I recently ran across this issue.
The documents show a way to deal with Commands.
Here is a link to their document: https://docs.cypress.io/guides/tooling/typescript-support#Adding-child-or-dual-commands
cypress/support/index.ts
// load type definitions that come with Cypress module
/// <reference types="cypress" />
declare global {
namespace Cypress {
interface Chainable {
/**
* Custom command to type a few random words into input elements
* #param count=3
* #example cy.get('input').typeRandomWords()
*/
typeRandomWords(
count?: number,
options?: Partial<TypeOptions>
): Chainable<Element>
}
}
}
cypress/support/index.ts
Cypress.Commands.add('typeRandomWords', { prevSubject: 'element' }, (
subject /* :JQuery<HTMLElement> */,
count = 3,
options?
) => {
return cy.wrap(subject).type(generateRandomWords(count), options)
})
currently I have some problem with strapi graphql query. I can only query about 100 items max.
here is my query:
query StudioList { studios(limit: -1) { id slug name } }
with or without limit always return 100 items. how do i query for more than 100?
thanks..
I found the solution:
if you have plugins.js file in your strapi ./config folder, then add the following code:
module.exports = {
//
graphql: {
endpoint: '/graphql',
shadowCRUD: true,
playgroundAlways: false,
depthLimit: 7,
amountLimit: 2500,
apolloServer: {
tracing: false,
},
},
};
change the amountlimit to whatever you want..
then restart the server, now it should shows more than 100 items.
I try with version of strap 3.6.8 but that's doesn't work. I rebuild strapi "npm build" & "yarn develop"
module.exports = {
//
graphql: {
endpoint: '/graphql',
shadowCRUD: true,
playgroundAlways: false,
depthLimit: 7,
amountLimit: 2500,
apolloServer: {
tracing: false,
},
},
};
Is it possible to use two different databases, i.e MongoDB and Redis, simultaneously in Strapi?
I want to keep track of my refresh tokens by Redis, while all other documents on Mongo.
Yes, buit Strapi does not support Redis
module.exports = ({ env }) => ({
defaultConnection: 'default', // this defines the default connections
connections: {
default: { //that's the default connection
connector: 'bookshelf',
settings: {
client: 'sqlite',
filename: env('DATABASE_FILENAME', '.tmp/main.db'), //uses main db
},
options: {
useNullAsDefault: true,
},
},
messages: { //that's the connection for messages db
connector: 'bookshelf',
settings: {
client: 'sqlite',
filename: env('DATABASE_FILENAME', '.tmp/messages.db'), //uses another db
},
options: {
useNullAsDefault: true,
},
},
},
});
So here`s the deal. At my workplace, we are trying to introduce ReactJS components in our web app (JSP/Struts2 etc).
So far I've built a component that is supposed to display a tree based on an object, here's a sample:
export default {
name: 'Global',
nodeid: 99,
toggled: true,
children: [
{
name: 'Mid Node',
nodeid: 0,
chosen: false,
pushed: false,
toggled: false,
children: [
{ name: 'Lower Node',
nodeid: 1,
chosen: false,
pushed: false,
toggled: false,
children: [{
name : "Low Child 1",
pushed: false,
toggled: false,
chosen:false
}]
}
]
}
]
};
What I want to do is receive this from a struts action response, rather than having it hard coded to a file which is what I did in my example.
import React from 'react';
import TreeComponent from 'proj-1/TreeComponent';
import HierarchyJson from './internal/Data';
export default function ExampleTreeComponent() {
return <TreeComponent hierarchyJson={HierarchyJson} functionMode={2} htmlId="tree1"/>
}
I've seen a ton of posts where spring is used, but I don't know what are my options in this case. I don't want to have to write an AJAX call to get the data after my JSP page has already rendered.
I am using the following and having an issue you delete an image that was uploaded.
The itemLimit is set to 6 since there are "3" image per uploaded item.
hideScaled: true
so it is only showing the one thumbnail with a single delete button.
How can I get the system to delete the three images form the internal object.
This happens if up upload images and delete a couple of times.
Thanks
$("#fine-uploader").fineUploader({
session: {
endpoint: 'imageStatus.cfm',
params : {transaction_id : 11205}
},
debug: true,
request: {
endpoint: 'upload.cfm',
params : {details : "2_250/786_05072014|4483|786|11205|2"}
},
validation: {
itemLimit: 6,
allowedExtensions: ["jpeg", "jpg", "gif" , "png"],
sizeLimit: 8000000 // 8 MiB
},
messages : {
tooManyItemsError : "Sorry but you are only able to upload 2 images"
},
deleteFile: {
enabled: true, // defaults to false
endpoint: 'upload_delete.cfm',
method: 'post',
params : {wallid : "786"}
},
retry: {
enableAuto: false
},
scaling: {
sendOriginal: true,
hideScaled: true,
sizes: [
{name: "THUMB_XX", maxSize: 113},
{name: "FULLIMAGE", maxSize: 450}
]
}
})
You can use the onDelete callback to manually delete the scaled images. When you hide the scaled images, the Id of the original image will be the highest id. So for instance, if you upload a single file, the original file will have an id=2, and the scaled images will have an id=1 and id=0. If you upload a 2nd image, the original id would be 5, and the scaled images would be 3 and 4.
You just need to detect which id is being delete, and then use the callback to also delete the previous 2 id's.
The following example should do the trick:
$('#fine-uploader').fineUploader({
validation: {
allowedExtensions: ["gif", "jpeg", "jpg", "png", "bmp"],
acceptFiles: "image/gif, image/jpeg, image/png, image/bmp",
sizeLimit: 5000000,
itemLimit: 6
},
deleteFile: {
enabled: true,
endpoint: "/MyEndPoint/DeleteImage",
method: 'POST',
},
scaling: {
sendOriginal: true,
hideScaled: true,
sizes: [
{ name: "small", maxSize: 350 },
{ name: "large", maxSize: 800 },
]
},
callbacks: {
onDelete: function (id) {
if (id == 2)
{
$("#fine-uploader").fineUploader("deleteFile", 0);
$("#fine-uploader").fineUploader("deleteFile", 1);
}
else if (id = 5)
{
$("#fine-uploader").fineUploader("deleteFile", 3);
$("#fine-uploader").fineUploader("deleteFile", 4);
}
},
},
});
The documentation is serious when it says that the hideScaled option literally only hides the scaled file items in the UI. If you elect to hide these items AND you are using a strict itemLimit, you'll need to listen for delete status changes for the original files and trigger code that deletes the scaled items as well through the API.