Problema para aparecer os dados da API com Node no Front

Estou montando um gráfico em Chart.js e preciso pegar os dados com uma API em Node, mas não está dando certo, segue o index.js:

const express = require('express')
const morgan = require('morgan')
const cors = require('cors')
const bodyParser = require('body-parser')
const routes = require('./config/routes')
const axios = require('axios')

const app = express()

app.use(morgan('dev'))
app.use(bodyParser.urlencoded({extended: false}))
app.use(express.json())
app.use(cors())
app.use(routes)

app.listen(21262, () => {
    console.log(`Express started at http://localhost:21262`)
})

o routes.js que ele faz citação é o seguinte código:

const { default: axios } = require('axios')
const express = require('express')
const routes = express.Router()


let db = (
    {memory: "(5,4,5,1,6,4,7,2.8,5,4.7,6)"},
    {xMemory: "('1','2','3','4','5','6','7','8','9','10','11')"}
)

routes.get('/', async(req, res) => {
    return res.json(db)
})

routes.post('/add', (req, res) => {
    const body = req.body

    if (!body) {
        return res.status(400).end()
    }

    db.push(body)
    return res.json(body)

})

routes.delete('/:id', (req, res) => {
    const id = req.params.id

    let newDB = db.filter(item => {
        if(!item(id))
            return item
    })

    db = newDB

    return res.send(newDB)
})


module.exports = routes

O arquivo dos gráfico é esse, onde na função getContent() no console.log(memory, xMemory) retorna como "undefined":

const api_url = `http://localhost:21262/`

async function getContent() {
    try {
        const response = await fetch(api_url)
        const data = await response.json()
        const {memory, xMemory} = data
        console.log(memory, xMemory)
    } catch (error) {
        console.log(error)
    }
}

chartIt()

async function chartIt() {
    await getContent();
    let memoryChart = new Chart(document.getElementById("memory-chart"), {
        type: 'line',
        data: {
            labels: xMemory,
            datasets: (
                {
                    label: 'Memory',
                    borderColor: '#00a389',
                    cubicInterpolationMode: 'default',
                    tension: 0.4,
                    data: memory
                }
            )
        },
        options: {
            maintainAspectRatio: false,
            elements: {
                line: {
                    borderWidth: 4
                },
                point: {
                    radius: 0
                }
            },
            plugins: {
                legend: {
                    display: false
                }
            },
            scales: {
                x: {
                    display: false,
                },
                y: {
                    display: false,
                }
                
            }
        }
    })
}

Product image can’t show on front home page after update SSL Certificate

I got this strange image broken after update SSL file.
I cleaned Magento Cache and image:resize but it can’t fixed.
Do somebody give me suggest?
Home page image broken

Btw I found the image src link is wrong, it should have file name after folder but it disappeared
.enter image description here

mac – MacOSX Big Sur – Terminal ZSH Shell Command’s Execute Sometimes With “!” Exclamation Symbol In Front

!str Refer to the most recent command starting with str.
this is the history expansion behavior.
type

man zshexpn

and check ‘Event Designators’, you will get the answer

An event designator is a reference to a command-line entry in the history list. In the list below, remember that the initial `!’ in
each item may be changed to another character by setting the histchars parameter.

   !      Start a history expansion, except when followed by a blank, newline, `=' or `('.  If followed immediately by a word designator
          (see the section `Word Designators'), this forms a history reference with no event designator (see the section `Overview').

   !!     Refer to the previous command.  By itself, this expansion repeats the previous command.

   !n     Refer to command-line n.

   !-n    Refer to the current command-line minus n.

   !str   Refer to the most recent command starting with str.

   !?str(?)
          Refer to the most recent command containing str.  The trailing `?' is necessary if this reference is to be followed by a modi-
          fier or followed by any text that is not to be considered part of str.

   !#     Refer  to  the  current command line typed in so far.  The line is treated as if it were complete up to and including the word
          before the one with the `!#' reference.

   !{...} Insulate a history reference from adjacent characters (if necessary).

2d – Dynamic Sort order For walking in front and behind stuff

I’m using tile maps, and I’m having a difficult time with the concept of walking both in front of things, and behind things and having the layers sort order show properly. Take the image below, I need it to behave like #1 AND #2, so that if you walk behind it, you get that nice layering. However, I also need it to act like #2 when infront of it without looking like #3. Is there some sort of way to make the top of the barrels sort order change depending on if the player is in front of it, or behind it?

I was looking at rule tiles, but that’s something else, unless there is some feature about it I do not know of.

enter image description here

Delete custom post type in front end and redirect to specific page

I made it possible to delete the post from the front end with this code (get_delete_post_link redirect):

<a class="button-iv" onclick="return confirm('are you sure...?');" href="<?php echo get_delete_post_link( $post->ID ); ?>" title="delete doc">Delete doc</a>

In functions.php i have this code for redirect after deleting the post:

function wpse132196_redirect_after_trashing_get() {
    if ( array_key_exists( 'trashed', $_GET ) && $_GET('trashed') == '1' ) {
    if (!is_admin()) {
       wp_redirect( home_url('/doc-area/doc') );
       exit;
    }
    }
}
add_action( 'parse_request', 'wpse132196_redirect_after_trashing_get' );

This works fine. But now I would like to create a different redirect for each custom post type.
So I add this control

if ( 'extra' == get_post_type() )

And the function become:

function wpse132196_redirect_after_trashing_get() {
if ('extra' == get_post_type()) {
    if ( array_key_exists( 'trashed', $_GET ) && $_GET('trashed') == '1' ) {
    if (!is_admin()) {
        wp_redirect( home_url('/doc-area/doc') );
        exit;
       }
      }
    }
}
add_action( 'parse_request', 'wpse132196_redirect_after_trashing_get' );

But now the redirect doesn’t work.
How can I get a redirect for each specific post type?

theming – Adding Count Up module to custom front page

My end goal is to put several Count Up numbers on my custom front page. But I’m having trouble getting it implemented.

First, I installed the Count Up library (https://github.com/inorganik/CountUp.js) and put it in the libraries directory.

Then in mytheme.libraries.yml, I put

countup:
  version: 1.0
  js:
    /libraries/countup.js/dist/countUp.umd.js: {}
  dependencies:
    - core/jquery

And then in page–front.html.twig, I put

{{ attach_library('mytheme/countup') }}
            <div class="countup">
              <div id="transit_count">0</div>
              <script>
                $(function() {
                  let transits = new CountUp('transit_count', 6699);
                  if (!transits.error) {
                    transits.start();
                  } else {
                    console.error(transits.error);
                  }
                });
              </script>
            </div>

When I flushed the cache, I got this error: “Uncaught ReferenceError: CountUp is not defined”.

What am I missing here? I’m pretty weak at JS so it could be something obvious.

Thanks!

database – Error on mysql only on front page

I’m using  Magento 2.3.6-p1

In Cli commands everything  works fine.

I can ran setup:upgrade, compilation, content:deploy, etc.

But, when I go to www.mystore.com I get the following:

2 exception(s):
Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE(HY000) (2002) No such file or directory
Exception #1 (PDOException): SQLSTATE(HY000) (2002) No such file or directory
Exception #0 (Zend_Db_Adapter_Exception): SQLSTATE(HY000) (2002) No such file or directory

You can view the entire error log goingo to www.infotatil.pt

I tried everything I found in Google. 

Changed host from “localhohst” to “127.0.0.1” in  /app/etc/env.php,  triple checked mysql credentials, tried to connect to  mysql in commandline, everything works fine, but magento web front  continue giving this error.

Server info:
cPanel  WHm 94.08, mysql maria DB 10.3, php 7.3.27

Thank you for any help;

image quality – Lens with small scratches on the front element – how do they affect IQ?

Here are two lenses I got off Ebay – they look pretty nice on images. The Canon 85mm 1.8 does have marks visible to the naked eye on the front element but they are very small. The Helios looked perfect on front and back but on an internal glass there is some dust particles.

Canon 85mm 1.8:

Canon85mm

Helios 44-2 58mm F2:

Helios

[image examples from two lenses I got from ebay]

Here are two shots with them, with wide apertures:

Canon85mm

Canon85mm

Helios

Helios

Confirms that “dust inside” or “scratches in front” doesn’t affect IQ.

But then I noticed spots when stopped down:

I used Helios when taking a macro of a brie and I needed to stop with to F16 to get just a little bit DOF – the black speckles are dust particles:

Dust shows up

But this turned out to be on the sensor, because the spots were the exact some place as the 85mm stopped down. I cleaned the sensor and it is fine now! Yeah :]

front end – List of all formatting elements available for .m files

I’m looking into generating .m files programmatically and would like to explore
different possibilities of formatting their content when opened in the front end.

For example, if you write

(* ::Subsection:: *)
(* See also *)
(* ::Text:: *)
(*foo, bar.*)

inside a .m file, the front end will display this as

enter image description here

This way, one can actually make .m files look nice while preserving their key advantages against notebooks (plain text, perfect for version control system, editing a single block doesn’t modify the whole file etc.)

Apparently, there are special keywords inside comments such as (* ::Section:: *), (* ::Subsection:: *), (* ::Text:: *), (* ::Title:: *) etc. that are parsed by the front end in a special way.

Does someone know, where can I find the full list of such keywords and their usage examples?