Category : dynamic-routing

I inherited a project where we use Next.js and we have a custom server.js handling routes like this: server.get(‘/blog/:category([a-zA-Z-]+)’, (req, res) => { return app.render(req, res, ‘/category’, { category: req.params.category, }); }); server.get(‘/blog/:category/:subcategory([a-zA-Z-]+)’, (req, res) => { return app.render(req, res, ‘/category’, { category: req.params.category, subcategory: req.params.subcategory, }); }); server.get(‘/blog/:category/post/:id’, (req, res) => { return app.render(req, ..

Read more

I want to fetch and display data from Array of Objects. I have created the parameterized routes. 1. app-routing.module.ts const routes: Routes = [ { path: ‘all-trades’, component: AllTradesComponent, }, { path: ‘crop/:name’, component: CropComponent }] 2. Crop.ts export class Crop { name: string; checked: boolean; subCategory: Subcategory[]; } export class Subcategory { id: number; ..

Read more

1. all-trades.component.ts import { Component, OnInit } from ‘@angular/core’; import { ActivatedRoute } from ‘@angular/router’; @Component({ selector: ‘app-all-trades’, templateUrl: ‘./all-trades.component.html’, styleUrls: [‘./all-trades.component.css’], }) export class AllTradesComponent implements OnInit { // This is my Array of Object crops = [ { name: ‘Rice’, checked: true, subCategory: [ { id: 1, name: ‘Basmati’, isActive: true, }, { ..

Read more

When I run nuxt generate with target: "static" in my nuxt.config.js, my dynamically-created routes do not accept their payload, which they get like so: ****nuxt.config.js**** generate: { routes() { return axios .get(`${process.env.ROOT_URL}/businesses`) .then(res => { return res.data.map(business => { return { route: `/business/${business.id}`, payload: business }; }); }); } } ****business.vue**** async asyncData({ params, store, ..

Read more