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

    How to launch Quasar using Express js, Mongo, and hot reloading?

    Framework
    express mongo nodejs
    2
    2
    1097
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      ma2i last edited by ma2i

      I’m writing a website using Quasar, and trying to figure out how to launch the quasar website using expressjs or better yet use ‘quasar dev’ to launch both the website and a separate backend. I can launch them separately if needed but I have to start up express anyway and we’re using it to host our current website and launch both the Angular front end and Mongo (plus the code that manages the database) backend.

      I’m also loving hot reloading and it occurs to me I might lose that if I launch Quasar that way.

      I’m thinking the best way to do it is to split the project into a front end for quasar and back end for expressjs that will handle mongo and launch them separately. My hesitation is that I believe that expressjs can be used in production, so it seems like maybe that’s the way to go here… so why split it in the first place.

      I’m not tied to express, just need to be able to run Mongo and our custom node.js code on the backend.

      Any advice to point me in the right direction?

      Thanks.

      R 1 Reply Last reply Reply Quote 0
      • R
        rhscjohn @ma2i last edited by rhscjohn

        @ma2i I have no idea if this is “best practice” but I use npm scripts to handle the backend server during development. My quasar project package.jon scripts section look like:

        "scripts": {
            "lint": "eslint --ext .js,.vue ./",
            "dev-graphql": "cd ../graphql-knex-npvr/ && npm run-script dev ",
            "server-graphql": "cd ../graphql-knex-npvr/ && npm run-script start ",
            "server-quasar": "quasar serve dist/spa -p 2000 --cors -o ",
            "publish-client": "xcopy dist\\spa  D:\\Users\\johni\\Projects\\graphql-knex-npvr\\public /s /d /e /y"
          },
        

        So, if I want to start the backend server in development mode, I open a New Terminal in VS Code and type the following

        npm run dev-graphql
        

        This runs the script: dev-grapql that is contained in the quasar project package.json file.

        The script(dev-graphql) performs 2 commands. The command are separated by &&. The first command changes the directory to point to the directory that contains the backend server. The second command runs a script call dev that is contained in the backend server project package-json file.

        My backend server is nodejs using Express, SQLite, and graphql. Now that I have my backend running, I switch back to my first VS Code terminal and run

        quasar dev
        

        When I am finished for the day, I switch back to the second terminal and do ctrl-c to terminate the backend server.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post