Questions tagged [routes]

Curious queries on the art of linking website addresses to specific functions and actions.

Navigating to a different page with fresh data in Express.js

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 ...

Puzzled by the specialized link feature

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 ...

Tips for sharing data between routes in Next.js App router

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 ...

The NextJS routing feature displays the [slug] parameter in the URL

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 ...

Tips for preventing caching on particular Nextjs API routes

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 ...

Customized queries based on conditional routes - expressjs

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 ...

Having trouble sending a parameter to the Controller in Visual Studio (version 2019)?

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 ...

An individual page application built with Next.js and React requires unique URLs for every item

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 ...

Navigate directly to the dashboard page in Angular 5 using RxJS without needing to load the main page first

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. ...

Subdomain-specific URL helper in ZF2

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 ...

Child Route Handling Based on Conditions (Angular)

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 ...

Troubleshooting routing problems in a Next.js application hosted on Azure's static web app

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 ...

The next.js router will update the URL without actually navigating to a new page, meaning that it will still display the current page with the updated URL

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 ...

Implementing cross-file method calls in Node.js using separate route files

//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 ...

Exploring the world of routing parameters in Express.js and AngularJS

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); ...

Configuring IIS Rewrite can be easily achieved by following these simple

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 ...

The vanilla JS router seems to be malfunctioning, as it is only showing the [object XMLDocument]

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 ...

Combining server-side and client-side routing in AngularJS: A comprehensive guide

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 ...

Steps to enable multiple users to log in through a single route

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 ...

Executing NodeJS custom middleware to show parent function being called

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) { ...

Using Twig: Transfer the content of a textfield as a parameter in the routing

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 ...

An error message indicating that the page is currently being unloaded has appeared

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 ...

Do you want to utilize the Express router with a unique twist?

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 ...

Prevent unauthorized entry into Angular 2 Component

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, ...

Navigating with AngularJS 1.6: Routing and More

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] ...

What is the best way to pass and save information across different routes in Express using Node.js?

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 ...

What could be causing the issue with React Router not functioning properly in Material UI?

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 ...

Angular 2: How to Avoid Exceeding Maximum Call Stack Size with Eager Loading

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 ...

Create individual account pages with specific URLs in Next.js

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 ...

Utilizing multiple routers in Express middleware for Node.js

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 ...

Changing the req.path property within an expressjs middleware

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 ...

Is React routing paired with React templates and an ExpressJS backend the way to go?

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 ...

Using .htaccess with Angular is specifically designed to function within a subfolder of

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 ...

Handling Navigation for URLs without Hash in AngularJS

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 ...

Using Sequelize to update all values in a JSON file through an Express router.put operation

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 ...

Steps for appending a prefix to every node/express route

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 ...

In a perplexing twist, requests made to the Express app arrive with empty bodies despite data being sent, but this anomaly occurs

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 ...

My Angular Router is creating duplicate instances of my route components

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 ...

Angularjs still facing the routing issue with the hashtag symbol '#' in the URL

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 ...

Expanding Nested List Components in Material-UI using ReactJS by utilizing the URL structure

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 ...

Are there any similar events to OnRouteChange in Angular?

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? ...

Can the ASP.NET MVC 3 route constraints be modified to return a 400 Bad Request with JSON responses instead?

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 ...

Issues with Angular's router outlet link functionality not performing as expected

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/ ...

What is the best way to clear a token from SessionStorage upon exiting an Angular application?

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 ...

Encountering a 404 Error When Accessing an Express.js Route with Parameters from the Client

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 ...

The route to /admin is unreachable with Laravel

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')-> ...

Having Trouble with Angular Route (6) Configuration

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 ...

Integrating React js with Layout.cshtml: Mastering the Fusion of React Routing and ASP.NET MVC Routing

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 ...

Secure your routes by verifying status on a separate server using JSON Web Token authentication service in NodeJS

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 ...

Troubleshooting: NavLink's activeClassName attribute malfunctioning after altering the 'to' attribute structure

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 ...

the pause in execution before my function redirects to a different route

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 ...

What distinguishes these two methods of invoking express.router from one another?

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 = ...

Building secure routes in Next.js using AWS access tokens

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 ...

Issues with Node.js routes on the express server aren't functioning as expected

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 ...

How to stop the execution of a function in Node.js

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) { ...

Navigating through concealed pathways

I have defined the following simple route configuration: const appRoutes: Routes = [ { path: 'login', component: LoginComponent }, { path: '', component: WidgetComponent }, { path: 'P3', component: DashboardComponent }, ...

What is the best way to make my if statement pause until a GET request finishes (GUARD) with the help of Angular?

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 ...

How to stop the previous page from reloading with Express.js routing?

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: ...

Issue with loading CSS in Angular 8 upon refreshing the page after building in production

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& ...

Having trouble with NextJs router 404 error when refreshing the page on Digital Ocean?

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 ...

I continue to encounter the following error message: Error: Route.post() expects callback functions but received an [object Undefined]

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 ...

Express: Routes for directing requests to designated handlers

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 ...

How come the useEffect hook is causing re-rendering on every page instead of just the desired endpoint?

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 ...

Passing the app variable from Express.js to routes

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) { ...

Node.js routing currently lacks the ability to easily verify the presence of a JWT token for every route

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 ...

What is the best way to deliver a static site through keystone?

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 ...

Sending information to the identical page using Express

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 ...

Resolve problems with implementing dynamic routes in Next.js

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 ...

How to Handle Laravel Routing with URL Query Parameters

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 ...

.pug form not directing to correct Node.js route handler

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 ...

developing versatile paths with Node.js

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 Next.js server-side rendering suitable for building dynamic routes to display profiles of social media app users?

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 ...

Contrasting the inclusion of the "route" keyword when defining routes in Express

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 ...

Unspecified parameter for Next.js dynamic route

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 ...

"Trouble encountered when trying to pass $order->id as form action in Laravel, resorting to use of hard

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= ...