Skip to content

Commit d788a47

Browse files
committed
readme chnages
1 parent 0d0ba33 commit d788a47

File tree

1 file changed

+41
-37
lines changed

1 file changed

+41
-37
lines changed

README.md

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ It uses package @nestjs/microservices.
760760
```https://docs.nestjs.com/fundamentals/testing``` <br />
761761
- Automated testing is considered an essential part of any serious software development effort. It is provides integration with Jest and Supertest out-of-the-box, while remaining agnostic to testing tools.
762762
763-
## Day 18 - NestJs-into (hello world)
763+
## Day 18 - NestJs-intro (hello world)
764764
765765
1. It is mainly used to create Rest API, a NodeJS framework, builds on ExpressJs.
766766
2. Embraces TypeScript, dependency Injection and Modularity("Angular for Backend")
@@ -769,19 +769,19 @@ It uses package @nestjs/microservices.
769769
5. Makes building complex application easy.
770770
771771
772-
6. Lets install NestJs first.
772+
6. Lets install NestJs first. <br />
773+
https://docs.nestjs.com/first-steps <br />
773774
774-
https://docs.nestjs.com/first-steps
775-
a) Open ```NodeJs command``` promt.
775+
a) Open ```NodeJs command``` promt. <br />
776776
Setting up a new project is quite simple with the Nest CLI. With npm installed. [It is similar to angular installation]
777-
<br>
777+
<br />
778778
b) ```npm i -g @nestjs/cli```
779779
780-
c) Create new project using NEST
781-
```nest new project-name```
782-
e.g. nest new day18-NestIntro
780+
c) Create new project using NEST <br />
781+
```nest new project-name``` <br />
782+
e.g. nest new day18-NestIntro <br />
783783
784-
it will ask for which package manager you want yo use for. I have chossen npm. Now it will install all th dependent packages.
784+
Tt will ask for which package manager you want yo use for. I have chossen npm. Now it will install all th dependent packages. <br />
785785
It takes 5 - 10 minute to install successfully.
786786
787787
<img src="https://github.com/getmscode2013/NodeJsTutorial/day18-nest-intro/NestPackaesInstalledsuccessfully.png">
@@ -791,56 +791,56 @@ a) now to see the diffrnce on the icon you can install extension "Material Icon
791791
b) so lets see the application structure.
792792
<img src="https://github.com/getmscode2013/NodeJsTutorial/day18-nest-intro/projectstructure.png">
793793
794-
- Node_module - consist all the package installed for application. - you can get details from package.json.
795-
- Src - is the mail folder on which we will work its contains all the source files.
796-
- Test - it is nothing but test setup for application. by default in jest.
797-
- .gitignore file - is file used to ignore the git uploads.
798-
- nest-cli.json file - It is nest configuration file.
799-
- package.json - contain all the installed module definations.
800-
- tsconfig.json - is type script configuratio files.
794+
-<u> Node_module </u> - consist all the package installed for application. - you can get details from package.json.
795+
- <u>Src </u> - is the mail folder on which we will work its contains all the source files.
796+
- <u>Test </u> - it is nothing but test setup for application. by default in jest.
797+
- <u>.gitignore file</u> - is file used to ignore the git uploads.
798+
- <u> nest-cli.json </u> file - It is nest configuration file.
799+
- <u> package.json </u> - contain all the installed module definations.
800+
- <u> tsconfig.json </u>- is type script configuratio files.
801801
802802
c) let see what we have in src.
803803
804-
- <b> main.ts <b/> - its entry point for application. nodejs not run typescript so code compile to javascript.
805-
if you will se the code here it is follow like expressJS.
804+
- <b> main.ts </b> - its entry point for application. nodejs not run typescript so code compile to javascript. <br />
805+
if you will se the code here it is follow like expressJS. <br />
806806
Creating the server and which will work on 3000 port.
807807
```ruby
808808
const app = await NestFactory.create(AppModule);
809809
await app.listen(3000);
810810
```
811811
- <b>app.module.ts </b>
812-
Nest is written the application in the moduler form like angular.
812+
Nest is written the application in the moduler form like angular.<br />
813813
As in above its written NEST is embraces modularity. Nest is not taken all the files in your working folder. it will take only which has imported their. <br />
814-
Imported part in NESTJs is controller and provide. As you need to list over here.
814+
Imported part in NESTJs is controller and provide. As you need to list over here.<br />
815815
```ruby
816816
controllers: [AppController], // bundle of controller
817817
providers: [AppService], // bundle of services
818818
```
819819
820-
> Controller : it is responsible to get the comming request and doing something and response it back.
821-
> Provider : it will inject the certain functionlaity to controller. it like service of database to get the data from database.
820+
> Controller : it is responsible to get the comming request and doing something and response it back.<br />
821+
> Provider : it will inject the certain functionlaity to controller. it like service of database to get the data from database. <br />
822822
823823
here you can see the ``` @module``` as the decorator which is attched to the class.
824824
825825
826826
- <b> app.controller.ts - </b>
827-
It is app class as AppController which is decorated by @controller.
827+
It is app class as AppController which is decorated by @controller. <br />
828828
It is having method of getHello() decorated by @Get
829829
in Appcontroller you will find the code like below.
830830
831831
```ruby
832832
@Controller()
833833
export class AppController {
834834
```
835-
Means it will accept the empty parameter like
835+
Means it will accept the empty parameter like<br />
836836
your-domain.com/
837837
838838
if you have the parameter in controller like user
839839
```ruby
840840
@Controller('user')
841841
export class AppController {
842842
```
843-
you need to use it like your-domain.com/user
843+
you need to use it like your-domain.com/user<br />
844844
845845
Same happan for the get also if it is like
846846
```ruby
@@ -865,31 +865,31 @@ this service should be registerd in the module. here you are declaring ut and us
865865
this.appService.getHello();
866866
```
867867
868-
-<b> app.service.ts </b>
868+
-<b> app.service.ts </b> <br />
869869
870-
All your login aout the application or DB call are written to the service.
871-
It is using @Injectable decorator code for AppService class. And defined a method like getHello in service.
870+
All your login aout the application or DB call are written to the service.<br />
871+
It is using @Injectable decorator code for AppService class. And defined a method like getHello in service.<br />
872872
```ruby
873873
getHello(): string {
874874
return 'Hello World!';
875875
}
876876
```
877-
Here you can write your complex logic.
877+
Here you can write your complex logic.<br />
878878
879879
- <b>app.controller.spec.ts </b>
880-
It used to write the unit test methods for app.controller
880+
It used to write the unit test methods for app.controller<br /><br />
881881
882882
8) Run application
883-
Now let run and see the application.
884-
> cd day18-nest-intro
885-
> npm run start
886-
or to run with nodemon
887-
> npm run start:dev
883+
Now let run and see the application. <br />
884+
> cd day18-nest-intro <br />
885+
> npm run start<br />
886+
or to run with nodemon <br />
887+
> npm run start:dev <br />
888888
889889
<img src="https://github.com/getmscode2013/NodeJsTutorial/day18-nest-intro/helloworld.png">
890890
891-
it is showing "hello world" it is giving the result of string from service.
892-
Lets change it to some of the JSON values. Changes in controller directly with below code.
891+
it is showing "hello world" it is giving the result of string from service.<br />
892+
Lets change it to some of the JSON values. Changes in controller directly with below code.<br />
893893
894894
```ruby
895895
export class AppController {
@@ -905,9 +905,13 @@ export class AppController {
905905
<img src="https://github.com/getmscode2013/NodeJsTutorial/day18-nest-intro/jsonoutput.png">
906906
907907
You can even define the heder also for your API you need to import header.
908+
909+
```ruby
908910
import { Controller, Get, Header } from '@nestjs/common';
911+
```
909912
910913
and add the decorator @Hedader like below.
914+
911915
```ruby
912916
@Get()
913917
@Header("Content-type",'test/html')

0 commit comments

Comments
 (0)