No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. frt
    F
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 4
    • Best 0
    • Groups 0

    frt

    @frt

    0
    Reputation
    8
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    frt Follow

    Latest posts made by frt

    • RE: api via express

      Yes, I finally realized my mistake in understanding the work of the cross-platform application and realized that the option I chose was irrational and meaningless. Many thanks for the clarification.

      posted in Framework
      F
      frt
    • RE: api via express

      Yes, I very poorly and incorrectly put it.

      What I want is the proxying of api requests to a separate express server, which will process them and return the data.
      In the nuxt’s /nuxt.config,js you can specify an api request handler as a parameter:

      module.exports = {
      serverMiddleware: [
          // Will register file from project api directory to handle /api/* requires
          { path: '/api', handler: '~/api/index.js' },
        ],
      }
      

      in api/index.js:

      const express = require('express');
      const bodyParser = require('body-parser');
      
      const app = express();
      app.use(bodyParser.json());
      
      // Register API routes
      const module1 = require('./routes/module1');
      const module2 = require('./routes/module2');
      
      // Import API Routes
      app.use('/user', module1);
      app.use('/item', module2);
      
      // Export the server middleware
      module.exports = {
        path: '/api',
        handler: app,
      };
      

      Yes, in quasar, I achieved the same result by importing modules into the srs-ssr/extension.js:

      const module1 = require('../api/routes/module1');
      const module2 = require('../api/routes/module2');
      
      app.use('/api/user', module1);
      app.use('/api/item', module2);
      

      It’s works in dev mode. But after build, quasar generate dist folder and required paths to modules become invalid. In addition, this solution is only for the SSR mode and is not cross-platform, which, it seems to me, is stupid and looks like a crutch.

      I hope this time I described my problem in more detail in understanding how to solve this, as it initially seemed to me, trivial task. 😁
      Thanks for the help

      posted in Framework
      F
      frt
    • api via express

      how to use quasar in parallel with Express in way it used in Nuxt (https://ru.nuxtjs.org/api/nuxt-render/ or as serverMiddleware in nuxt.config.js) ?

      posted in Framework
      F
      frt