question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Controller Section of Overview needs clarity.

See original GitHub issue

For controllers, there was a lack of detail regarding the intended structure of the tutorial app that should be looked at.

For “Last Step,” I saw in the app.module.ts example that the CatsController was supposed to go in a folder called cats.

import { CatsController } from './cats/cats.controller';

I had it on the same level as app.module.ts, which I thought was intentional for the purposes of the Nest introduction.

It also isn’t clear what routes are generated based on the decorators.

The @Get() decorator tells Nest that it’s necessary to create an endpoint for this route path, and map every appropriate request to this handler. Since we declared the prefix for every route (cats), Nest will map every /cats GET request here.

So what does the route look like? /cats/findAll ??

If it’s just GET /cats, then what happens if I have more than one GET?

It isn’t clear whether the Observable streams are recommended or Async Await for controllers.

Is ‘body-parser’ installed with the TypeScript starter? I got an error until I installed with NPM.

Maybe I’m just being nitpicky. Still, these are concerns that are preventing me from moving on to Components. Mostly because I can’t seem to import cats.controller as a module.

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
bkbonnercommented, Oct 17, 2017

@arswaw it looks like the @Get() decorator takes a string path that will be appended to the path of the controller.

I.e. in a controller defined as

@Controller(‘/users’) @Get(‘/list’)

would respond to /users/list

With no path specified it defaults to ‘/’.

The decorator is defined here:. https://github.com/nestjs/nest/blob/master/src/common/utils/decorators/request-mapping.decorator.ts

The path string is whatever is used in express.

This can probably be better explained in the docs.

@kamilmysliwiec. Where is the repo for the docs? One of us could do a pull request for this.

1reaction
kamilmysliwieccommented, Nov 18, 2017

Hi @arswaw @bkbonner The docs repo is public now https://github.com/nestjs/docs.nestjs.com Please feel free to create any pull requests based on your best judgment 😺 Appreciate each help. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clarity CONTROL - Amazon S3
INTRODUCTION. When logging into Clarity CONTROL as an administrator, you will have more functionality available to you than other user types.
Read more >
Clarity on best practices · Issue #872 · Instagram/IGListKit
These section controllers should have numberOfItems always return 1 and will have the appropriate object available within them (e.g. Comment, ...
Read more >
How do I enable Clarity using Instant Config via Airwave?
This is going to sound beyond stupid, but here goes. I'm trying to follow the instructions here so I can get Clarity up...
Read more >
PANEL DISCUSSION: Creating Control Clarity: How to Write ...
This course highlights a new IES Lighting Practice document which articulates how to create lighting Control Intent Narratives and Sequences of ...
Read more >
Frequently asked questions | Microsoft Learn
Clarity is GDPR-compliant as a data controller. ... To start using Clarity, you need access to your website's <head> section to include the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found