While browsing the homepage, I come across a list of names. Clicking on one of the names triggers a post request to the backend. At this point, my goal is twofold: firstly, fetch the corresponding profile data from the database; secondly, redirect to the p ...
As I delve into the world of React and Next.js, I find myself working on the link component. Initially, I had a grasp on basic routing in next.js which seemed pretty straightforward. However, things took a confusing turn when I stumbled upon this code: imp ...
Currently using App router and in need to transfer parameters as an object without reliance on useParams & useSearchParams Suppose there is an object named person const person: Person = { name: "John Doe", age: 25, address: "123 M ...
I am encountering an issue with my NextJS app's folder structure: - pages - docs - [slug] - index - [id] - index These pages are intended to be dynamic, displaying data dynamically on the UI. This means that users can navigate t ...
In my Next.js application, I have an API route at /api/auth/signout that is responsible for clearing a specific cookie and returning JSON data. The issue arises when I deploy the project to Vercel - initially, this API route works correctly by clearing th ...
Can we customize queries based on optional routes? app.get('/:category/:item?', function (req, res) { var category = req.params.category; var item = req.params.item; var sqlQuery = 'SELECT * FROM items WHERE category = ? AND item = ?&a ...
I'm facing an issue with passing parameters from a method to the Controller. Interestingly, when I manually run it with the parameter in Postman, everything works fine. Is there a way to pass the parameter to the Controller without creating individua ...
I recently created a single-page application using Next JS, React JS, and Tailwind CSS to load various items from Firebase. One of the challenges I am facing is allowing users to reference a specific item from the URL and easily share it with others ...
Utilizing Firebase as the API in my application for authentication, database management, and storage. Implemented a main page (localhost:4200) that loads when the user is not logged in, and a dashboard (localhost:4200/dashboard) for authenticated users. ...
I currently have a website that consists of four subdomains: http://www.domain.com/ http://dev.www.domain.com/ # (development environment for www.domain.com) http://blog.domain.com/ http://dev.blog.domain.com/ # (development environment for blog.do ...
Can a child route be conditionally displayed as a default? I want users to land on a specific child route based on their past orders (e.g., go to the store page if they ordered from a physical store, online page for online orders, or social page otherwise ...
I recently developed a Next.js application that connects to a database through an API in order to display data in the form of folder structures. If a row in the database is identified as a folder, it should be displayed as such, while if it is not, then it ...
My search results are displayed at the route /discovery, and I am working on syncing the search state with URL query parameters. For example, if a user searches for "chicken," the URL becomes /discovery?query=chicken&page=1. When a user clicks on a se ...
//index.js file const express = require('express'); const app = express(); const PORT = 8888; const bodyParser = require('body-parser'); const userRoutes = require("./routes/user"); const adminRoutes = require("./routes/admin"); const ...
Struggling to configure routes with parameters in an AngularJS application supported by a node.js server running on express. The setup involves Node routing all unspecified paths to a catch-all function: app.use(express.bodyParser()); app.use(app.router); ...
My project utilizes PHP and Angular, hosted on IIS. I have enabled the html5Mode in Angular, allowing me to use routes like localhost/home instead of locahost/#/home. The issue arises when I copy and paste the URL (for example: http://localhost/home) into ...
Recently, I attempted to implement routing into my JavaScript application using the following example: link. However, after diligently copying every file from the project, all I see displayed inside the <main></main> tags is "[object XMLDocum ...
Currently, I am in the process of transitioning a project to an Angular-based Single Page Application (SPA). The project is originally built using node/locomotivejs and serves templates from the server side. Due to its large size, we are converting it to A ...
I've developed a login code for managing two different schemas - User and Admin. Currently, I have separate login routes: /login for normal users and super admins, and /adminLogin for admin users and super admins. My goal is to merge these two schemas int ...
Goal: Showcase the parent function of a middleware function shared = require('./RoutFuctions'); app.post('/link', shared.verifyToken, (req, res) => { ... } In the middleware function exports.verifyToken = function(req, res, next) { ...
I have a task of redirecting to another page while passing along the value from a textfield. Here is my current code: {% extends "base.html.twig" %} {% block body %} <button onclick="host()">Host the session</button> <button onclic ...
While working on a NodeJS-ReactJS Isomorphic App, I encountered an issue when clicking on a Link. An error message popped up saying: Uncaught (in promise) Error: Request has been terminated Possible causes: the network is offline, Origin is not allowed by ...
When faced with the task of displaying a custom 404 page on non-existent routes, I implemented the following code: // Custom 404 page router.use(function(req, res) { res.render('404', {layout: false, title: '404: File Not Found'}); }); The issue arose ...
Is there a way to restrict users from accessing any route until they are logged in? I need help with implementing this feature in Angular 2 Component Routing. Appreciate any assistance, ...
As I set up the routing for my AngularJS v1.6 app, I encountered a small issue. An error message popped up and I can't seem to pinpoint the root cause. Can anyone provide insights on what might be causing this error? Uncaught Error: [$injector:modulerr] ...
Let's delve into the specific functionalities I envision for my server. Essentially, my project involves user registration and login processes. The URLs for these routes are as follows - localhost:3000/login and localhost:3000/register Upon successful lo ...
I'm currently working on creating a tab and adding routing inside the first tab. However, I am facing an issue where the desired page does not display after clicking on the link. Strangely, upon refreshing the page, the corresponding page appears as e ...
I'm facing an issue with preloading all of my child route modules. In my root routing module, I have the following configuration: RouterModule.forRoot(appRoutes, { preloadingStrategy: AppCustomPreloader }) The structure of AppCustomPreloader is as follow ...
I'm currently working on developing a website that will feature individual user pages showcasing their posts and additional information. I'm facing some difficulty in figuring out how to generate new links to access these user accounts. For instance, if ...
How do I successfully display my data from mongoDB that is organized into collections? I am able to access the data individually, but encounter difficulties when trying to retrieve them collectively. Here is an example of how my code is structured: Within ...
I'm currently in the process of developing a middleware that will help eliminate locale strings from the path, such as /de/about becoming /about. This project is being implemented using express. To achieve this, I initially tried out the following mid ...
I am trying to navigate the complexities of integrating a React front-end with an ExpressJS back-end. Despite my efforts to find a comprehensive tutorial, I have not come across one that clearly explains the distinction between React-Routing on the front-e ...
After deploying my app on a Debian 11 Apache server within the folder var/www/html (specifically in var/www/html/foo), I encountered issues with routing and hard refreshing, resulting in a 404 error whenever I attempted to refresh a page. The Angular app c ...
When trying to navigate to URLs with hashes, such as http://www.example.com/#/random, the redirection works properly. But when attempting to access http://www.example.com/random, instead of redirecting, I receive a "Cannot GET /random" error message. Is ...
I've been working on a feature in my Express router that updates data in a MySQL schema for 'members' of clubs. The members table has various columns like member_id, forename, surname, address, etc. I've successfully created an Express route using Sequeliz ...
Is there a way to automatically add a prefix before all routes in express configuration? For instance, my current routes are: / /route1 /route2 But I would like to include a prefix like: /prefix/ /prefix/route1 /prefix/route2 Currently, I have to m ...
Welcome to the community of inquisitive individuals on Stack! I'm facing an interesting challenge while developing an Express app. Despite everything running smoothly with two routes, I've hit a roadblock with one route that seems to have empty incoming ...
I have captured screenshots of the application: https://ibb.co/NmnSPNr and https://ibb.co/C0nwG4D info.component.ts / The Info component is a child component of the Item component, displayed when a specific link is routed to. export class InfoComponent imp ...
I have recently made changes to my index.html file and updated $locationProvider in my app.js. After clicking on the button, I noticed that it correctly routes me to localhost:20498/register. However, when manually entering this URL, I still encounter a 4 ...
I'm currently working with ReactJS and Material-UI. Is there a way to have the MUI nested list display specific items based on the URL? For example, if a user is on /inbox/starred/, I want the Inbox item to be open and Starred to be highlighted. I att ...
I'm looking to execute a function every time a route changes in Angular. Does Angular have an event similar to OnRouteChange for this purpose? ...
Currently, I am working on developing REST resources with the ASP.NET MVC 3 framework. So far, my experience has been positive as I enjoy the flexibility that MVC 3 offers and find it easy to create REST services. However, I have encountered difficulties w ...
I am encountering difficulties trying to create a link to a named router outlet in Angular. Let's focus on the most crucial part of the code: app-routing-module.ts: import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/ ...
I need to clear my sessionStorage every time I exit my application. App Module: export class AppModule implements OnInit, OnDestroy{ constructor(private overlayService: OverlayService, private logger: LoggerService, private userService: UserService, pr ...
I've set up a server route like this: (https://github.com/leptone/lang-exchange-react/blob/master/server.js) app.route('user/:username') .get((req, res) => { console.log(req.params.username) db.findOne({ username: req.pa ...
Recently, I began a new project using Laravel 5.7 and implemented the standard Laravel Auth with artisan. As part of this process, a new route was added to routes/web.php as shown below: Route::get('/home', 'HomeController@index')-> ...
I've been experiencing some unusual issues with the Angular 6 router, but this particular one is really frustrating. Here are the routes that I have defined in routing-app.module.ts: export const routes: Routes = [ { path: 'login', c ...
My current project involves an ASP.NET MVC core application with the View written in cshtml. The routing follows the conventional asp.net mvc routing pattern. However, I've recently implemented a new module using React JS. Now, I'm faced with the challen ...
Currently, I am working on a project where I am developing an API using Node/Express/Mongo and also building a website with the same tools. I would like to host these on separate servers for scalability purposes. For authentication, I have implemented jso ...
Everyone is familiar with using 'to' to specify the route we want to go: <NavLink to={`${option.value}`} activeClassName="active">Click Me </NavLink> However, if we modify it to: <NavLink to={{ pathname: `${option.valu ...
Currently, I am developing a page using nodeJs with express which is supposed to display a table. However, I encountered an issue with my variable "allMusique" that contains the data for my page. When trying to access it initially, there seems to be an err ...
As a newcomer to Node/Express, I have been exploring the documentation and following tutorials. I noticed that there are two different ways to initialize the Express Router. Is there any significant difference between them? First Method: const express = ...
After saving the AWS access token in local storage, I attempted to create a higher order component. The goal was to check if the token is present or not in local storage, redirecting to the login page when it's missing. However, there seems to be an i ...
I used to have a node.js express server up and running on my previous server. However, after migrating to a new server, the code seems to have stopped functioning. Let me share the setup of my server: var fs = require('fs'); var express = requi ...
Currently facing an issue with the route below: router.post('/create', function(req, res, next) { if(!req.user) res.redirect("/"); Survey.find({ surveyName: req.body.surveyName }, function(error, survey) { if(survey) { ...
I have defined the following simple route configuration: const appRoutes: Routes = [ { path: 'login', component: LoginComponent }, { path: '', component: WidgetComponent }, { path: 'P3', component: DashboardComponent }, ...
I am currently working on implementing admin routes for my Angular app, and I have used a role guard to handle this. The code snippet below showcases my implementation: However, I would like the get request to finish executing before the if statement begi ...
Just starting out with express and web development in general, I have a question regarding routing. Currently, I am working on a web app using Firebase with pure JS and implementing routing on Firebase cloud functions. The routing logic is outlined below: ...
Here is the structure of my index.html: <!doctype html> <html lang="hu"> <head> <meta charset="utf-8"> <title>WebsiteName</title> <base href="/"> <meta name="viewport& ...
I am currently working with a NextJs project that has been exported as a static site and is being hosted on Digital Ocean's App platform. I am using next/router to handle routing within the application. One issue that I have encountered is when attempting ...
Currently, I am in the process of setting up a react express application that utilizes mongo db as its database. During the initial stages, I keep encountering this particular error message: Error: Route.post() requires callback functions but got a [obje ...
I have set up an Express app with a all('/', ...) handler on the main path. Within this handler, I am checking for a failure flag and need to make a decision on whether to proceed to the next handler or directly route the request to the /error endpoint wit ...
I am a novice attempting to retrieve data from a database and display it on the front-end using Axios, ReactJS, and TypeScript. My intention is for the data to be rendered specifically on localhost:3000/api/v1/getAll, but currently, it is rendering on all ...
I am attempting to transfer some data from the app (variable defined as var app = express();) to some Socket.IO related code by sending a value to a middleware in a similar manner: function routes(app) { app.post('/evento', function (req, res) { ...
I have a node application where, upon routing to ('/login') with valid credentials, I generate a JWT token with an expiry time and direct the user to the next page. If the user tries to access any other route directly (e.g., '/home') af ...
I currently have a website built using Keystone and another one that is completely static. My goal is to combine the static site into the Keystone site. When users visit "/", they should see the static site, but if they navigate to "/resources", they wil ...
I'm looking for a way to pass data from the server back to the same page in case there is an error with the posted data. Currently, I have two routes set up - one for displaying content and the other for adding new content. I am using Pug as my view ...
I have been learning about Next.js and I am struggling with understanding how to set up dynamic routing. I have the following setup: https://i.stack.imgur.com/uBPdm.png https://i.stack.imgur.com/YYSxn.png "use client" import React from "reac ...
I am working on a route called stats. This is how my current routing setup looks like: Route::get('stats', 'StatsController@index'); Route::get('stats/{query}', 'StatsController@store'); The main objective is to display stat data when someone visits the ...
On the home page ('/'), I have a basic form that appears. After submitting the form, the browser redirects correctly to the /search route with multiple query parameters: http://localhost:3000/search?allergens=en%3Aegg&preferences=en%3Avegan&catego ...
app.js // Including Routes require("./routes")(app); router folder index.js module.exports = function (app) { app.use("/", require("./all_routes")); } all_routes.js var express = require("express"); var route ...
Is it possible to implement dynamic routes in Next.js for Server Side Rendering with fetched data? I have noticed that most examples and explanations of dynamic routes in Next.js are focused on Static Site Generation... I am currently working on a social ...
Can you explain the distinction between router.route('/create') .post(validate(hotelValidation.createHotel), function (req, res) { and just router.post('/create', validate(hotelValidation.createHotel), function (req, res) { Are these two methods e ...
Currently, I am developing an e-commerce application using next.js with Typescript and MongoDB. To better understand my project, let's take a look at my existing file structure: https://i.stack.imgur.com/tZqVm.png The mainPage.tsx file is responsibl ...
After thorough debugging, I found an interesting issue in the code. Initially, when I debugged using {{ dd($order->id) }}, it correctly displayed the order id value of 100238. However, the following form action did not work as expected: <form action= ...