-
Notifications
You must be signed in to change notification settings - Fork 1
/
nextjs.html
834 lines (739 loc) · 40.1 KB
/
nextjs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="assets/img/mainlogo.jpg" type="image/x-icon">
<title>Home</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous" />
<link rel="stylesheet" href="assets/css/style.css" />
<link rel="stylesheet" href="assets/prismjs/prism.css" />
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="myDesigns/assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic">
<link rel="stylesheet" href="myDesigns/assets/fonts/font-awesome.min.css">
<link rel="stylesheet" href="myDesigns/assets/fonts/simple-line-icons.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css" />
<style>
.scroll-to-top {
background-color: #f77b50 !important;
text-decoration: none !important;
}
.scroll-to-top:hover {
background: #f77b50 !important;
text-decoration: none !important;
}
footer .scroll-to-top {
text-decoration: none !important;
}
.offcanvas {
width: 700px !important; /* Override the default width */
}
</style>
</head>
<body id="page-top">
<nav class="navbar fixed-top navbar-expand-lg navbar-dark" style="background-color: rgb(1,4,45);">
<div class="container-fluid">
<a class="navbar-brand" href="index.php">
<img src="assets/img/mainlogo.jpg" alt="" style="height: 7vh;"> Cheatbook
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="index.php">Home</a>
</li>
<!--frontend -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Frontend
</a>
<ul class="dropdown-menu multi-column columns-2">
<div class="row">
<div class="col-sm-6">
<ul class="multi-column-dropdown">
<li><a class="dropdown-item" href="html.php">HTML</a></li>
<li><a class="dropdown-item" href="css.php">CSS</a></li>
<li><a class="dropdown-item"
href="javascript.php">JavaScript</a></li>
<li><a class="dropdown-item"
href="typescript.php">TypeScript</a></li>
<li>
<hr class="dropdown-divider" />
</li>
<li class="dropdown-header">JavaScript Frameworks</li>
<li><a class="dropdown-item" href="reactjs.php">Reacjs</a></li>
<li><a class="dropdown-item" href="nextjs.php">Nextjs</a></li>
<li><a class="dropdown-item"
href="angularjs.php">Angularjs</a></li>
<li><a class="dropdown-item" href="remix.php">Remixjs</a></li>
<li><a class="dropdown-item" href="vuejs.php">vuejs</a></li>
</ul>
</div>
<div class="col-sm-6">
<ul class="multi-column-dropdown">
<li><a class="dropdown-item" href="astrojs.php">Astrojs</a></li>
<li><a class="dropdown-item" href="electronjs.php">electronjs</a></li>
<li>
<hr class="dropdown-divider" />
</li>
<li class="dropdown-header">CSS Framework</li>
<li><a class="dropdown-item" href="bootstrap.php">Bootstrap</a></li>
<li><a class="dropdown-item" href="tailwindcss.php">Tailwind css</a></li>
<li><a class="dropdown-item" href="materialui.php">Material UI</a></li>
<li> <hr class="dropdown-divider" /> </li>
<li class="dropdown-header">State Management</li>
<li><a class="dropdown-item" href="redux.php">Redux</a></li>
</ul>
</div>
</div>
</ul>
</li>
<!-- backend -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Backend
</a>
<ul class="dropdown-menu multi-column columns-2">
<div class="row">
<div class="col-sm-6">
<ul class="multi-column-dropdown">
<li><a class="dropdown-item" href="django.php">Django</a></li>
<li><a class="dropdown-item" href="flask.php">Flask</a></li>
<li><a class="dropdown-item" href="fastapi.php">Fastapi</a></li>
<li><a class="dropdown-item" href="expressjs.php">Expressjs</a></li>
<li><a class="dropdown-item" href="nodejs.php">Nodejs</a></li>
<li><a class="dropdown-item" href="php.php">PHP</a></li>
<li><a class="dropdown-item" href="golang.php">GO</a></li>
<li><a class="dropdown-item" href="spring.php">Spring</a></li>
<li><a class="dropdown-item"href="springboot.php">Springboot</a></li>
<li> <hr class="dropdown-divider" /></li>
<li class="dropdown-header">Databases</li>
<li><a class="dropdown-item" href="Sql.php">SQL</a></li>
</ul>
</div>
<div class="col-sm-6">
<ul class="multi-column-dropdown">
<li><a class="dropdown-item" href="mysql.php">MySQL</a></li>
<li><a class="dropdown-item" href="mongodb.php">MongoDB</a></li>
<li><a class="dropdown-item" href="firebase.php">Firebase</a></li>
<li><a class="dropdown-item" href="cassandra.php">Cassandra</a></li>
<li><a class="dropdown-item" href="redis.php">Redis</a></li>
<li><a class="dropdown-item" href="postgresql.php">PostgreSQL</a></li>
<li><a class="dropdown-item" href="influxdb.php">infixDB</a></li>
<li> <hr class="dropdown-divider" /> </li>
<li class="dropdown-header">Java technologies</li>
<li><a class="dropdown-item" href="hibernet.php">Hibernet</a></li>
<li><a class="dropdown-item" href="jdbc.php">jdbc</a></li>
<li><a class="dropdown-item" href="servlets.php">servlets</a></li>
</ul>
</div>
</div>
</ul>
</li>
<!-- programming -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Programming
</a>
<ul class="dropdown-menu multi-column columns-2">
<div class="row">
<div class="col-sm-6">
<ul class="multi-column-dropdown">
<li><a class="dropdown-item" href="cplus.php">C++</a></li>
<li><a class="dropdown-item" href="c.php">C</a></li>
<li><a class="dropdown-item" href="java.php">Java</a></li>
<li><a class="dropdown-item" href="python.php">Python</a></li>
</ul>
</div>
<div class="col-sm-6">
<ul class="multi-column-dropdown">
<li class="dropdown-header">Data structure</li>
<li><a class="dropdown-item" href="dsa.php">DSA</a></li>
</ul>
</div>
</div>
</ul>
</li>
<!-- databases -->
<li class="nav-item dropdown mx-1">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Design
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="figma.php">Figma</a></li>
<li><a class="dropdown-item" href="adobexd.php">AdobeXD</a></li>
</ul>
</li>
<!-- API & Authentication -->
<li class="nav-item dropdown mx-1">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
API & Auth
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="restfulapi.php">RESTful API</a></li>
<li><a class="dropdown-item" href="graphql.php">GraphQL</a></li>
<li><a class="dropdown-item" href="jwtauth.php">JWT Auth</a></li>
<li><a class="dropdown-item" href="apollo.php">Apollo</a></li>
</ul>
</li>
<!-- testing -->
<li class="nav-item dropdown mx-1">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Testing
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="jest.php">Jest</a></li>
</ul>
</li>
<!-- cloud services -->
<li class="nav-item dropdown mx-1">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Cloud
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="aws.php">AWS</a></li>
<li><a class="dropdown-item" href="azure.php">Azure</a></li>
<li><a class="dropdown-item" href="googlecloud.php">Google Cloud</a></li>
<li><a class="dropdown-item" href="cloudflare.php">Cloudflare</a></li>
</ul>
</li>
<!-- Mobile Development-->
<li class="nav-item dropdown mx-1">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Mobile Dev
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="android.php">Android</a></li>
<li><a class="dropdown-item" href="kotlin.php">Kotlin</a></li>
<li><a class="dropdown-item" href="reactnative.php">React Native</a></li>
<li><a class="dropdown-item" href="flutter.php">Flutter</a></li>
</ul>
</li>
<!-- Devops -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Devops
</a>
<ul class="dropdown-menu multi-column columns-2">
<div class="row">
<div class="col-sm-6">
<ul class="multi-column-dropdown">
<li class="dropdown-header">CI/CD</li>
<li><a class="dropdown-item" href="docker.php">Docker</a></li>
<li><a class="dropdown-item" href="jenkins.php">jenkins</a></li>
<li><a class="dropdown-item" href="kubernetes.php">kubernetes</a></li>
<li><a class="dropdown-item" href="maven.php">Maven</a></li>
<li><a class="dropdown-item" href="git.php">Git</a> </li>
<li><a class="dropdown-item" href="github_action.php">Github Actions</a></li>
<li><a class="dropdown-item" href="Terraform.php">Terraform</a></li>
<li><a class="dropdown-item" href="ansible.php">Ansible</a></li>
<li><hr class="dropdown-divider" /></li>
<li class="dropdown-header">Web Servers</li>
<li><a class="dropdown-item" href="languages/devops/nginx.php">Nginx</a>
</li>
</ul>
</div>
<div class="col-sm-6">
<ul class="multi-column-dropdown">
<hr class="dropdown-divider" />
</li>
<li class="dropdown-header">Operating System</li>
<li><a class="dropdown-item" href="windows.php">Windows</a>
</li>
<li><a class="dropdown-item" href="linux.php">Linux</a>
</li>
<li><a class="dropdown-item" href="macos.php">Macos</a>
</li>
<li>
<hr class="dropdown-divider" />
</li>
<li class="dropdown-header">Scripting</li>
<li><a class="dropdown-item" href="bashscript.php">Bash Scripting</a>
</li>
<li>
<hr class="dropdown-divider" />
</li>
<li class="dropdown-header">Monitoring</li>
<li><a class="dropdown-item" href="monit.php">Monit</a>
</ul>
</div>
</div>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="about.php">About Us</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Tools
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="tools/shadowpicker/index.html">Shadow Picker</a></li>
<li><a class="dropdown-item" href="tools/readmemaker/index.html">Github Project Readme</a>
</li>
<li><a class="dropdown-item" href="tools/profilereadme/index.html">Github Profile Readme</a>
</li>
<li><a class="dropdown-item" href="tools/gradientcolorpicker.html">Gradient Colour
Picker</a></li>
<li><a class="dropdown-item" href="tools/colourbook/colorpiceker.html">Colour Picker</a>
</li>
<li><a class="dropdown-item" href="tools/codereview/index.html">Simple Code Editor</a> </li>
<li><a class="dropdown-item" href="tools/banner/index.html">Banner Maker</a> </li>
<li><a class="dropdown-item" href="tools/logomaker/index.html">Logo & Favicon Maker</a>
</li>
<li><a class="dropdown-item" href="tools/paraiso-colors-main/index.html">colour plates</a>
</li>
</ul>
</li>
</ul>
<a href="myDesigns/index.html">
<div class="button btn1 mx-1" style="font-size: 1em;">My Designs</div>
</a>
</div>
</div>
</nav> <!-- mid part -->
<nav class="mt-5 p-2 headline" style="background:linear-gradient(to top right, #fb5475 0%, #f77b50 59%);">
<div class="text-center " style="margin-top:5vh;"><img style="margin-right:2vh;"
src="../../assets/img/nextjs-icon.svg" alt="" />NextJS cheatsheet
</div>
</nav>
<div class="container">
<div class="p-5 mb-4 bg-light rounded-3 jumbo mt-2">
<div class="container-fluid py-3">
<h1 class="display-5 fw-bold">NextJS</h1>
<div class="row">
<div class="col-md-6">
<p class="fs-4">
The Next.js is React Based framework with server side rendering capability. It is very fast
and SEO friendly. Using Next.js, you can create robust react based application quite easily
and test them.
</p>
</div>
<div class="col-md-6 text-center">
<img src="../../assets/img/nextjs-icon.svg" alt="" style="height:100%;" />
</div>
</div>
<button class="btn btn1" type="button" data-bs-toggle="offcanvas" data-bs-target="#o1"
aria-controls="o1">
Read More...
</button>
<a href="https://nextjs.org/docs">
<div class="button btn1 mx-1 text-center" style="font-size: 1em;width:5em;">Docs</div>
</a>
<div class="offcanvas offcanvas-start" data-bs-scroll="true" tabindex="-1" id="o1"
aria-labelledby="offcanvasWithBothOptionsLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="offcanvasWithBothOptionsLabel">
NextJS
</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<p>
The Next.js is React Based framework with server side rendering capability. It is very fast
and SEO friendly.
<br>
Using Next.js, you can create robust react based application quite easily and test them.
Following are the key features of Next.js.
<br><br><br>
Hot Code Reload : Next.js server detects modified files and reloads them automatically.
<br><br>
Automatic Routing : No need to configure any url for routing. files are to be placed in
pages folder. All urls will be mapped to file system. Customization can be done.
<br><br>
Component specific styles : styled-jsx provides support for global as well as component
specific styles.
<br><br>
Server side rendering : react components are prerendered on server hence loads faster on
client.
<br><br>
Node Ecosystem : Next.js being react based gels well with Node ecosystem.
<br><br>
Automatic code split : Next.js renders pages with libraries they need. Next.js instead of
creating a single large javascript file, creates multiples resources. When a page is loaded,
only required javascript page is loaded with it.
<br><br>
Prefetch : Next.js provides Link component which is used to link multiple components
supports a prefetch property to prefetch page resources in background.<br><br>
Dynamic Components : Next.js allows to import JavaScript modules and React Components
dynamically.
<br><br>
Export Static Site : Next.js allows to export full static site from your web application.
<br><br>
Built-in Typescript Support : Next.js is written in Typescripts and provides excellent
Typescript support.
<br />
</p>
</div>
</div>
</div>
</div>
<ol>
<!-- offcanvas -->
<li>
Create Next App
<pre class="language-sh">
<code>
npx create-next-app@latest
</code>
</pre>
<pre class="language-sh">
<code>
yarn create next-app
</code>
</pre>
</li>
<li>
start app
<pre class="language-sh">
<code>
npm run start
</code>
</pre>
<pre class="language-sh">
<code>
yarn run dev
</code>
</pre>
</li>
<li>
create 404 error file
<br>
create not-found.js file then nextjs automatically set as error file (in file 'notfound' fuction used)
</li>
<li>
create loading spinner
<br>
create loading.js file then nextjs automatically set loading spinner
</li>
<li>
set every page css
<br>
create css file in styles folder and rename as about.module.css
</li>
<li>
next/link <button class="btn btn1" type="button" data-bs-toggle="offcanvas" data-bs-target="#o2"
aria-controls="o1">
Read More...
</button>
<div class="offcanvas offcanvas-start" data-bs-scroll="true" tabindex="-1" id="o2"
aria-labelledby="offcanvasWithBothOptionsLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="offcanvasWithBothOptionsLabel">
next/link
</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
Client-side transitions between routes can be enabled via the Link component exported by
next/link.
<br><br>
For an example, consider a pages directory with the following files:
<br><br>
pages/index.js<br>
pages/about.js<br>
pages/blog/[slug].js<br><br><br>
Link accepts the following props:
<br><br>
href - The path or URL to navigate to. This is the only required prop. It can also be an object,
see example here<br>
as - Optional decorator for the path that will be shown in the browser URL bar. Before Next.js
9.5.3 this was used for dynamic routes, check our previous docs to see how it worked. Note: when
this path differs from the one provided in href the previous href/as behavior is used as shown
in the previous docs.
legacyBehavior - Changes behavior so that child must be <a>. Defaults to false.<br>
passHref - Forces Link to send the href property to its child. Defaults to false<br>
prefetch - Prefetch the page in the background. Defaults to true. Any
<Link /> that is in the viewport (initially or through scroll) will be preloaded. Prefetch
can be disabled by passing prefetch={false}. When prefetch is set to false, prefetching will
still occur on hover. Pages using Static Generation will preload JSON files with the data
for faster page transitions. Prefetching is only enabled in production.
replace - Replace the current history state instead of adding a new url into the stack.
Defaults to false
scroll - Scroll to the top of the page after a navigation. Defaults to true<br>
shallow - Update the path of the current page without rerunning getStaticProps,
getServerSideProps or getInitialProps. Defaults to false<br>
locale - The active locale is automatically prepended. locale allows for providing a
different locale. When false href has to include the locale as the default behavior is
disabled.
Note, when legacyBehavior is not set to true, all anchor tag properties can be passed to
next/link as well such as, className, onClick, etc.<br>
</div>
</div>
<pre class="language-jsx">
<code>
import Link from 'next/link'
</code>
</pre>
<pre class="language-jsx">
<code>
<ul>
<li>
<Link href="/">Home</Link>
</li>
<li>
<Link href="/about">About Us</Link>
</li>
<li>
<Link href="/blog/hello-world">Blog Post</Link>
</li>
</ul>
</code>
</pre>
<div class="accordion" id="accordionExample">
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
<h1> tag: “define heading of an HTML page but with first
level”
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse" aria-labelledby="headingOne"
data-bs-parent="#accordionExample">
<div class="accordion-body">
<pre class="language-html">
<code>
<h1>
//heading content
</h1>
</code>
</pre>
</div>
</div>
</div>
</div>
</li>
<li>
add css in page
<pre class="language-sh">
<code>
import StyleSheet from '@/app/styles/main.module.css'
const page = () => {
return (
<div>
<h1 className={StyleSheet.mainmy}>contactus</h1>
</div>
)
}
export default page
</code>
</pre>
</li>
<li>
add font in layout page
<pre class="language-sh">
<code>
import { Roboto } from 'next/font/google'
const roboto = Roboto({
weight: '400',
subsets: ['latin'],
display: 'swap',
})
export default function RootLayout({ children }) {
return (
<html lang="en" className={roboto.className}>
<body>{children}</body>
</html>
)
}
</code>
</pre>
</li>
<li>
Nextjs Dynamic Route(create [id] name folder and in this folder create page.js) (slug)
<pre class="language-sh">
<code>
<Link href={`/movie/${id}`}>
</code>
</pre>
</li>
<li>
connect database to nextjs app. first create utils folder in src.then create file dbconn.js in utils
<pre class="language-sh">
<code>
import mongoose from "mongoose";
const MONGODB_URL = process.env.MONGODB_URL;
if (!MONGODB_URL) {throw new Error("Please define the MONGODB_URI environment variable inside .env.local" )}
let cached = global.mongoose;
if (!cached) {cached = global.mongoose = { con: null, promise: null }}
const dbConnect = async () => {
if (cached.conn) {return cached.conn; }
if (!cached.promise) {
const opts = { bufferCommands: false };
cached.promise = mongoose.connect(MONGODB_URL, opts).then((mongoose) => {return mongoose;});}
try {cached.conn = await cached.promise;} catch (e) {
cached.promise = null;
throw e;
}
return cached.conn;
};
export default dbConnect;
</code>
</pre>
</li>
<li>
add css in page
<pre class="language-sh">
<code>
</code>
</pre>
</li>
<li>
add css in page
<pre class="language-sh">
<code>
</code>
</pre>
</li>
<li>
add css in page
<pre class="language-sh">
<code>
</code>
</pre>
</li>
<li>
add css in page
<pre class="language-sh">
<code>
</code>
</pre>
</li>
<li>
add css in page
<pre class="language-sh">
<code>
</code>
</pre>
</li>
<li>
add css in page
<pre class="language-sh">
<code>
</code>
</pre>
</li>
<li>
add css in page
<pre class="language-sh">
<code>
</code>
</pre>
</li>
<li>
add css in page
<pre class="language-sh">
<code>
</code>
</pre>
</li>
</ol>
</div>
</div>
<!-- Footer -->
<footer class="text-lg-start bg-dark text-muted footer-dark mt-5" style="background-color: rgb(1,4,45) !important;">
<!-- Section: Social media -->
<section class="d-flex justify-content-lg-between p-4 border-bottom" style="color: white">
<!-- Left -->
<div class="me-5 d-none d-lg-block" style="font-size: 1.7em;">
<span>Get connected with us on social networks:</span>
</div>
<!-- Left -->
<!-- Right -->
<div>
<!-- Facebook -->
<a class="btn text-white btn-floating m-1" style="background-color: #3b5998" href="#!" role="button"><i
class="bi bi-facebook"></i></a>
<!-- Twitter -->
<a class="btn text-white btn-floating m-1" style="background-color: #55acee" href="#!" role="button"><i
class="bi bi-twitter"></i></a>
<!-- Google -->
<a class="btn text-white btn-floating m-1" style="background-color: #dd4b39" href="#!" role="button"><i
class="bi bi-google"></i></a>
<!-- Instagram -->
<a class="btn text-white btn-floating m-1" style="background-color: #ac2bac" href="#!" role="button"><i
class="bi bi-instagram"></i></a>
<!-- Linkedin -->
<a class="btn text-white btn-floating m-1" style="background-color: #0082ca"
href="https://www.linkedin.com/in/mr-soham-manjrekar/" role="button"><i
class="bi bi-linkedin"></i></a>
<!-- Github -->
<a class="btn text-white btn-floating m-1" style="background-color: #333333"
href="https://github.com/sohammanjrekar" role="button"><i class="bi bi-github"></i></a>
</div>
<!-- Right -->
</section>
<!-- Section: Social media -->
<!-- Section: Links -->
<section class="links" style="color: white">
<div class="container text-md-start mt-5">
<!-- Grid row -->
<div class="row mt-3">
<!-- Grid column -->
<div class="col-md-8 col-lg-8 col-xl-8 mx-auto mb-4">
<!-- Content -->
<h2 class="text-uppercase fw-bold mb-4">
<i class="bi bi-gem me-3"></i>Cheatbook
</h2>
<p>
<li>Quick reference</li>
<li>Be productive after learning a new thing
</li>
<li>Quickly recall when forget some syntax</li>
<li>Use snippets for rapid development</li>
</p>
</div>
<!-- Grid column -->
<div class="col-md-4 col-lg-4 col-xl-4 mx-auto mb-md-0 mb-4" style="font-size: 1.3em;">
<!-- Links -->
<h2 class="text-uppercase fw-bold mb-4">Contact</h2>
<p><i class="bi bi-house-door me-3"></i>Badlapur,mumbai</p>
<p><i class="bi bi-envelope me-3"></i> mrsohammanjrekar@gmail.com</p>
<p><i class="bi bi-phone me-3"></i> +91 7045208474</p>
<p><i class="bi bi-whatsapp me-3"></i> +91 7045208474</p>
</div>
<!-- Grid column -->
</div>
<!-- Grid row -->
</div>
</section>
<!-- Section: Links -->
<!-- Copyright -->
<div class="text-center p-4" style="background-color: rgba(0, 0, 0, 0.05);color:white;word-spacing: 3px;">
© 2022 Copyright:
<a class="text-reset fw-bold" href="https://github.com/sohammanjrekar">cheatbook.com</a> created by Soham
Manjrekar
</div>
<!-- Copyright -->
<a class="js-scroll-trigger scroll-to-top rounded" href="#page-top"><i class="fa fa-angle-up"></i></a>
</footer>
<!-- Footer -->
<!-- Footer -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script src="../../myDesigns/assets/js/jquery.min.js"></script>
<script src="../../myDesigns/assets/bootstrap/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js"></script>
<script src="../../myDesigns/assets/js/stylish-portfolio.js"></script>
<script src="assets/prismjs/prism.js"></script>
</body>
</html>