commit
707a7242fc
143 changed files with 14482 additions and 10138 deletions
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
@ -0,0 +1,15 @@ |
||||
import { PartyPopper } from 'lucide-react'; |
||||
|
||||
export function AppChecklist() { |
||||
return ( |
||||
<div className="fixed bottom-6 right-3"> |
||||
<a |
||||
href="/get-started" |
||||
className="flex items-center gap-2 rounded-full border border-slate-900 bg-white py-2 pl-3 pr-4 text-sm font-medium hover:bg-zinc-200" |
||||
> |
||||
<PartyPopper className="relative -top-[2px] h-[20px] w-[20px] text-purple-600" /> |
||||
Welcome! Start here |
||||
</a> |
||||
</div> |
||||
); |
||||
} |
@ -0,0 +1,78 @@ |
||||
import { ExternalLink, Globe2, type LucideIcon } from 'lucide-react'; |
||||
|
||||
type RoadmapCardProps = { |
||||
title: string; |
||||
description: string; |
||||
icon: LucideIcon; |
||||
icon2?: LucideIcon; |
||||
link: string; |
||||
isUpcoming?: boolean; |
||||
}; |
||||
export function RoadmapCard(props: RoadmapCardProps) { |
||||
const { |
||||
isUpcoming, |
||||
link, |
||||
title, |
||||
description, |
||||
icon: Icon, |
||||
icon2: Icon2, |
||||
} = props; |
||||
|
||||
if (isUpcoming) { |
||||
return ( |
||||
<div className="group relative block rounded-xl border border-gray-300 bg-gradient-to-br from-gray-100 to-gray-50 p-5 overflow-hidden"> |
||||
<div className="mb-2 sm:mb-5 flex flex-row items-center"> |
||||
<div className="flex h-7 w-7 sm:h-9 sm:w-9 items-center justify-center rounded-full bg-gray-900 text-white"> |
||||
<Icon className="h-3 sm:h-5" /> |
||||
</div> |
||||
{Icon2 && ( |
||||
<> |
||||
<span className="mx-2 text-gray-400">+</span> |
||||
<div className="flex h-7 w-7 sm:h-9 sm:w-9 items-center justify-center rounded-full bg-gray-900 text-white"> |
||||
<Icon2 className="h-3 sm:h-5" /> |
||||
</div> |
||||
</> |
||||
)} |
||||
</div> |
||||
<span className="mb-0.5 block text-lg sm:text-xl font-semibold sm:mb-2"> |
||||
{title} |
||||
</span> |
||||
<span className="text-sm text-gray-500">{description}</span> |
||||
|
||||
<div className="absolute inset-0 flex flex-col items-center justify-center bg-gray-100/70"> |
||||
<span className="text-sm bg-black rounded-lg text-white font-semibold py-1 px-2 -rotate-45 transform"> |
||||
Coming soon |
||||
</span> |
||||
</div> |
||||
</div> |
||||
); |
||||
} |
||||
|
||||
return ( |
||||
<a |
||||
href={link} |
||||
target={'_blank'} |
||||
className="group relative block rounded-xl border border-gray-300 bg-gradient-to-br from-gray-100 to-gray-50 |
||||
p-3.5 sm:p-5 transition-colors duration-200 ease-in-out hover:cursor-pointer hover:border-black/30 hover:bg-gray-50/70 hover:shadow-sm" |
||||
> |
||||
<div className="mb-2 sm:mb-5 flex flex-row items-center"> |
||||
<div className="flex h-7 w-7 sm:h-9 sm:w-9 items-center justify-center rounded-full bg-gray-900 text-white"> |
||||
<Icon className="h-4 sm:h-5" /> |
||||
</div> |
||||
{Icon2 && ( |
||||
<> |
||||
<span className="mx-2 text-gray-400">+</span> |
||||
<div className="flex h-7 w-7 sm:h-9 sm:w-9 items-center justify-center rounded-full bg-gray-900 text-white"> |
||||
<Icon2 className="h-4 sm:h-5" /> |
||||
</div> |
||||
</> |
||||
)} |
||||
</div> |
||||
<ExternalLink className="lucide lucide-external-link absolute right-2 top-2 h-4 text-gray-300 transition group-hover:text-gray-700" /> |
||||
<span className="mb-0 block text-lg sm:text-xl font-semibold sm:mb-2"> |
||||
{title} |
||||
</span> |
||||
<span className="text-sm text-gray-500">{description}</span> |
||||
</a> |
||||
); |
||||
} |
@ -0,0 +1,63 @@ |
||||
import { ExternalLink } from 'lucide-react'; |
||||
|
||||
type RoadmapMultiCardProps = { |
||||
roadmaps: { |
||||
title: string; |
||||
link: string; |
||||
}[]; |
||||
description: string; |
||||
secondaryRoadmaps?: { |
||||
title: string; |
||||
link: string; |
||||
}[]; |
||||
secondaryDescription?: string; |
||||
}; |
||||
export function RoadmapMultiCard(props: RoadmapMultiCardProps) { |
||||
const { roadmaps, description, secondaryRoadmaps, secondaryDescription } = props; |
||||
return ( |
||||
<div |
||||
className="relative flex flex-col overflow-hidden rounded-xl border border-gray-300 bg-gradient-to-br from-gray-100 |
||||
to-gray-50 ease-in-out" |
||||
> |
||||
<div className="flex flex-col divide-y"> |
||||
{roadmaps.map((roadmap, index) => ( |
||||
<a |
||||
target={'_blank'} |
||||
key={index} |
||||
href={roadmap.link} |
||||
className="group text-sm sm:text-base flex w-full items-center justify-between gap-2 bg-gradient-to-br from-gray-100 to-gray-50 px-4 sm:px-5 py-2 transition-colors duration-200" |
||||
> |
||||
{roadmap.title} |
||||
<ExternalLink className="lucide lucide-external-link h-4 text-gray-300 transition group-hover:text-gray-700" /> |
||||
</a> |
||||
))} |
||||
</div> |
||||
|
||||
<p className="flex-grow bg-gray-200/70 p-4 sm:p-5 text-sm text-gray-500"> |
||||
{description} |
||||
</p> |
||||
|
||||
{secondaryRoadmaps && ( |
||||
<div className="flex flex-col divide-y"> |
||||
{secondaryRoadmaps.map((roadmap, index) => ( |
||||
<a |
||||
target={'_blank'} |
||||
key={index} |
||||
href={roadmap.link} |
||||
className="group text-sm sm:text-base flex w-full items-center justify-between gap-2 bg-gradient-to-br from-gray-100 to-gray-50 px-5 py-2 transition-colors duration-200" |
||||
> |
||||
{roadmap.title} |
||||
<ExternalLink className="lucide lucide-external-link h-4 text-gray-300 transition group-hover:text-gray-700" /> |
||||
</a> |
||||
))} |
||||
</div> |
||||
)} |
||||
|
||||
{secondaryDescription && ( |
||||
<p className="flex-grow bg-gray-200/70 p-4 sm:p-5 text-sm text-gray-500"> |
||||
{secondaryDescription} |
||||
</p> |
||||
)} |
||||
</div> |
||||
); |
||||
} |
@ -0,0 +1,29 @@ |
||||
import { type ReactNode } from 'react'; |
||||
import { SectionBadge } from './SectionBadge.tsx'; |
||||
|
||||
type RoleRoadmapsProps = { |
||||
badge: string; |
||||
title: string; |
||||
description: string; |
||||
children: ReactNode; |
||||
}; |
||||
|
||||
export function RoleRoadmaps(props: RoleRoadmapsProps) { |
||||
const { badge, title, description, children } = props; |
||||
|
||||
return ( |
||||
<div className="bg-gradient-to-b from-gray-100 to-white py-5 sm:py-8 md:py-12"> |
||||
<div className="container"> |
||||
<div className="text-left"> |
||||
<SectionBadge title={badge} /> |
||||
</div> |
||||
<div className="my-4 sm:my-7 text-left"> |
||||
<h2 className="mb-1 text-xl sm:text-3xl font-semibold">{title}</h2> |
||||
<p className="text-sm sm:text-base text-gray-500">{description}</p> |
||||
|
||||
<div className="mt-4 sm:mt-7 grid sm:grid-cols-2 md:grid-cols-3 gap-3">{children}</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
); |
||||
} |
@ -0,0 +1,12 @@ |
||||
type SectionBadgeProps = { |
||||
title: string; |
||||
}; |
||||
export function SectionBadge(props: SectionBadgeProps) { |
||||
const { title } = props; |
||||
|
||||
return ( |
||||
<span className="rounded-full bg-black px-3 py-1 text-sm text-white"> |
||||
{title} |
||||
</span> |
||||
); |
||||
} |
@ -0,0 +1,31 @@ |
||||
import { useState } from 'react'; |
||||
|
||||
type TipItemProps = { |
||||
title: string; |
||||
description: string; |
||||
}; |
||||
export function TipItem(props: TipItemProps) { |
||||
const { title, description } = props; |
||||
|
||||
const [isToggled, setIsToggled] = useState(false); |
||||
|
||||
return ( |
||||
<div className="flex flex-col"> |
||||
{!isToggled && ( |
||||
<div |
||||
onClick={() => setIsToggled(true)} |
||||
className="cursor-pointer rounded-lg sm:rounded-xl bg-black px-3 py-2 text-sm sm:text-base text-white" |
||||
> |
||||
{title} |
||||
</div> |
||||
)} |
||||
{isToggled && ( |
||||
<p |
||||
className="rounded-lg sm:rounded-xl bg-gray-200 px-3 py-2 text-black text-sm sm:text-base" |
||||
> |
||||
{description} |
||||
</p> |
||||
)} |
||||
</div> |
||||
); |
||||
} |
@ -1,5 +1,5 @@ |
||||
<div |
||||
class='prose-xl prose-blockquote:font-normal prose container prose-code:bg-transparent prose-h2:text-3xl prose-h2:mt-10 prose-h2:mb-3 prose-h3:mt-2 prose-img:mt-1' |
||||
class='prose-xl prose-blockquote:font-normal prose container prose-code:bg-transparent prose-h2:text-3xl prose-h2:mt-10 prose-h2:mb-3 prose-h5:font-medium prose-h3:mt-2 prose-img:mt-1' |
||||
> |
||||
<slot /> |
||||
</div> |
||||
|
@ -0,0 +1,105 @@ |
||||
import { |
||||
BookOpen, |
||||
BookOpenText, |
||||
CheckSquare, |
||||
FileQuestion, |
||||
Menu, |
||||
Shirt, |
||||
Video, |
||||
Waypoints, |
||||
} from 'lucide-react'; |
||||
import { useRef, useState } from 'react'; |
||||
import { cn } from '../lib/classname.ts'; |
||||
import { useOutsideClick } from '../hooks/use-outside-click.ts'; |
||||
|
||||
const links = [ |
||||
{ |
||||
link: '/roadmaps', |
||||
label: 'Roadmaps', |
||||
description: 'Step by step learning paths', |
||||
Icon: Waypoints, |
||||
}, |
||||
{ |
||||
link: '/best-practices', |
||||
label: 'Best Practices', |
||||
description: "Do's and don'ts", |
||||
Icon: CheckSquare, |
||||
}, |
||||
{ |
||||
link: '/questions', |
||||
label: 'Questions', |
||||
description: 'Test and Practice your knowledge', |
||||
Icon: FileQuestion, |
||||
}, |
||||
{ |
||||
link: '/guides', |
||||
label: 'Guides', |
||||
description: 'In-depth articles and tutorials', |
||||
Icon: BookOpenText, |
||||
}, |
||||
{ |
||||
link: 'https://youtube.com/@roadmapsh', |
||||
label: 'Videos', |
||||
description: 'Animated and interactive content', |
||||
Icon: Video, |
||||
isExternal: true, |
||||
}, |
||||
{ |
||||
link: 'https://cottonbureau.com/people/roadmapsh', |
||||
label: 'Shop', |
||||
description: 'Get some cool swag', |
||||
Icon: Shirt, |
||||
isExternal: true, |
||||
}, |
||||
]; |
||||
|
||||
export function NavigationDropdown() { |
||||
const dropdownRef = useRef<HTMLDivElement>(null); |
||||
const [isOpen, setIsOpen] = useState(false); |
||||
|
||||
useOutsideClick(dropdownRef, () => { |
||||
setIsOpen(false); |
||||
}); |
||||
|
||||
return ( |
||||
<div className="relative flex items-center" ref={dropdownRef}> |
||||
<button |
||||
className={cn('text-gray-400 hover:text-white', { |
||||
'text-white': isOpen, |
||||
})} |
||||
onClick={() => setIsOpen(true)} |
||||
onMouseOver={() => setIsOpen(true)} |
||||
> |
||||
<Menu className="h-5 w-5" /> |
||||
</button> |
||||
<div |
||||
className={cn( |
||||
'absolute pointer-events-none left-0 top-full z-[999] mt-2 w-48 min-w-[320px] -translate-y-1 rounded-lg bg-slate-800 py-2 opacity-0 shadow-xl transition-all duration-100', |
||||
{ |
||||
'pointer-events-auto translate-y-2.5 opacity-100': isOpen, |
||||
}, |
||||
)} |
||||
> |
||||
{links.map((link) => ( |
||||
<a |
||||
href={link.link} |
||||
target={link.isExternal ? '_blank' : undefined} |
||||
rel={link.isExternal ? 'noopener noreferrer' : undefined} |
||||
key={link.link} |
||||
className="group flex items-center gap-3 px-4 py-2.5 text-gray-400 transition-colors hover:bg-slate-700" |
||||
> |
||||
<span className="flex h-[40px] w-[40px] items-center justify-center rounded-full bg-slate-600 transition-colors group-hover:bg-slate-500 group-hover:text-slate-100"> |
||||
<link.Icon className="inline-block h-5 w-5" /> |
||||
</span> |
||||
<span className="flex flex-col"> |
||||
<span className="font-medium text-slate-300 transition-colors group-hover:text-slate-100"> |
||||
{link.label} |
||||
</span> |
||||
<span className="text-sm">{link.description}</span> |
||||
</span> |
||||
</a> |
||||
))} |
||||
</div> |
||||
</div> |
||||
); |
||||
} |
@ -0,0 +1,25 @@ |
||||
import { useEffect } from 'react'; |
||||
import { isLoggedIn } from '../../lib/jwt'; |
||||
import { httpPost } from '../../lib/http'; |
||||
import type { ResourceType } from '../../lib/resource-progress'; |
||||
|
||||
type PageVisitProps = { |
||||
resourceId?: string; |
||||
resourceType?: ResourceType; |
||||
}; |
||||
|
||||
export function PageVisit(props: PageVisitProps) { |
||||
const { resourceId, resourceType } = props; |
||||
|
||||
useEffect(() => { |
||||
if (!isLoggedIn()) { |
||||
return; |
||||
} |
||||
|
||||
httpPost(`${import.meta.env.PUBLIC_API_URL}/v1-visit`, { |
||||
...(resourceType && { resourceType, resourceId }), |
||||
}).finally(() => {}); |
||||
}, []); |
||||
|
||||
return null; |
||||
} |
@ -0,0 +1,394 @@ |
||||
--- |
||||
title: 'The 5 Best Backend Development Languages to Master (2024)' |
||||
description: 'Discover the best backend development languages to master in 2024.' |
||||
author: |
||||
name: 'Fernando Doglio' |
||||
url: 'https://twitter.com/deleteman123' |
||||
imageUrl: '/authors/fernando.jpeg' |
||||
excludedBySlug: '/backend/languages' |
||||
seo: |
||||
title: 'The 5 Best Backend Development Languages to Master (2024)' |
||||
description: 'Discover the best backend development languages to learn right now for career development, with practical tips from an experienced developer.' |
||||
isNew: true |
||||
type: 'textual' |
||||
date: 2024-01-18 |
||||
sitemap: |
||||
priority: 0.7 |
||||
changefreq: 'weekly' |
||||
tags: |
||||
- 'guide' |
||||
- 'textual-guide' |
||||
- 'guide-sitemap' |
||||
--- |
||||
|
||||
Web development is typically divided into two main categories: [backend development](https://roadmap.sh/backend) and [frontend development](https://roadmap.sh/frontend). Frontend development focuses on the visible part of the application for end-users, i.e. the part that users interact with, while backend development involves writing code that remains unseen but is essential for the functioning of all applications—the business logic. |
||||
|
||||
Two of the key components when it comes to backend development are the programming language that you are going to code in and the database. In this article, we will be looking into a subset of programming languages that could be used for backend development. We will be discussing the pros and cons of each and the community to help you pick the best programming language for backend development. |
||||
|
||||
Without further ado, let’s get started! |
||||
|
||||
## What are backend languages? |
||||
|
||||
When it comes to web development, there is a very clear distinction between frontend and backend technologies. |
||||
|
||||
While the frontend ecosystem is quite limited to JavaScript (and other JavaScript-based languages, like TypeScript) due to Browser compatibility, the backend (A.K.A server-side) is a very different scenario. |
||||
|
||||
![Backend Languages](/guides/backend-languages/back-vs-front.png) |
||||
|
||||
Please note that neither of those lists is extensive, as they’re both constantly growing. |
||||
|
||||
You can think of a backend language as one that “runs on the server side”. That said, by that definition, any language is a backend language because even JavaScript nowadays can be used on the backend as well (thanks to Node, Bun, and Deno). |
||||
|
||||
However, we can go one step further and say: |
||||
|
||||
> “A backend language is a server side programming language that has the tools and frameworks required to build web backends” |
||||
|
||||
That will narrow down the list a little bit. But essentially, we can think of backend languages as anything that fits the following list: |
||||
|
||||
- Is able to listen for incoming HTTP/S connections. |
||||
- Can access databases. |
||||
- Can send HTTP/S requests. |
||||
- Can access the filesystem. |
||||
- Has a rich ecosystem of tools and frameworks to build web applications. |
||||
|
||||
With those features and a rich ecosystem of libraries and frameworks, a language can definitely be considered “backend-ready”. |
||||
|
||||
## Why learn a backend programming language? |
||||
|
||||
If you’re already a backend developer, then the main reason would be to become a more versatile developer. The more languages you know, the better code you’ll write. Either because you’ve learned different ways of solving the same problem, or simply because you’ll be able to contribute to more projects. |
||||
|
||||
If, on the other hand, you’re just getting started, the main reason would be that you’re entering an industry that’s always looking for people. |
||||
|
||||
## Is the market in demand for backend developers? |
||||
|
||||
One thing to keep in mind right now is that the software development market is always in demand for devs. For example, the [U.S. Bureau of Labor Statistics gives our industry a 25% growth rate](https://www.bls.gov/ooh/computer-and-information-technology/software-developers.htm) (demand-wise) from 2022 to 2023, whereas the mean for other industries is 3%. |
||||
|
||||
According to [JetBrains, during 2022, 75% of developers were involved with web development](https://www.jetbrains.com/lp/devecosystem-2022/) in one fashion or another, so whether you’re backend devs or frontend devs, there is always someone looking for you. |
||||
|
||||
That said, we also have to consider that this industry is becoming a global industry. While some countries might still be fighting that process back, most developers can directly access the global market and work for any company in the world. |
||||
|
||||
That is a great opportunity for a backend developer who lives in an area where there isn’t a big IT industry; however, it also means competing with every other developer in the world. That might cause the illusion that the IT industry is in recession or that there are no job opportunities for developers. |
||||
|
||||
There are always opportunities; it’s just that you're now after the same job that many others from around the world are after as well. |
||||
|
||||
That said, backend devs are always in high demand because they’re the bread and butter of any web application. They’re always required to create the underlying platform that will power most systems, so the key to standing out here is to stay up-to-date with the industry’s trends and technologies. |
||||
|
||||
Don’t get me wrong. You can’t possibly be expected to keep up with every single programming language that is released or with all the new frameworks that are created every month. However, keeping an eye on the industry and understanding what survives long enough to become a new industry standard is important. You have to keep updating yourself and learning new technologies/skills constantly; that way, you’ll stay relevant. |
||||
|
||||
## Is learning a backend language good for your career? |
||||
|
||||
Whether you’re a frontend developer looking to become full-stack (someone who can code both the backend and the frontend of an application), or if you’re new to the industry and you’re thinking if this might be the best place for you, the answer is “yes”. |
||||
|
||||
Backend developers are always in demand, so adding a new tool to your already existing toolbelt (if you’re already a dev) will only make you more flexible in the eyes of your employer. |
||||
|
||||
But remember, a language is just a language until you give it context. If you’re wondering whether or not one of the backend languages in this article might be for you, the answer will always be “yes”. However, understand that if backend development is new to you, you will also need to pick up other skills and backend technologies around the language, such as: |
||||
|
||||
- Understanding HTTP. |
||||
- Learning Structured Query Language (SQL) to query your databases. |
||||
- Understanding how APIs work. |
||||
- What server side rendering means and how to take advantage of it. |
||||
- What web servers are and how to use them/build them. |
||||
|
||||
Otherwise, you’ll understand the language, but you won’t know how to use it for the role of backend development. |
||||
|
||||
## Top 5 Backend Languages to Learn for Web Development |
||||
|
||||
With that introduction out of the way, let’s see the top 5 backend programming languages that you might want to learn if you’re looking to broaden your horizons in the server-side world. |
||||
The languages we’ll cover are: |
||||
|
||||
- Python |
||||
- Java |
||||
- JavaScript |
||||
- PHP |
||||
- Go |
||||
|
||||
Why these languages specifically? |
||||
|
||||
They’re some of the most known and used languages in the industry right now (see [StackOverflow’s 2023 Developer Survey](https://survey.stackoverflow.co/2023/#most-popular-technologies-language-prof)). That said, keep in mind that these are all great options, and they’re not presented here in any particular order. |
||||
|
||||
### Python |
||||
|
||||
Python has been around for decades already and while it’s never been the most popular option, it has always managed to stay within the top 5 choices. People love it for being easy to read, straightforward, and able to handle all sorts of tasks, making it a top pick for developers globally. Sure, Python's got a big name in data processing and machine learning, but let's not forget its solid impact on web development!. |
||||
|
||||
What makes Python extra appealing, especially for beginners, is the fact that reading and writing it feels very much like English (or at least, as pseudo code). This makes it a top choice for folks just starting out in coding. |
||||
|
||||
#### Beginner Accessibility and Learning Resources |
||||
|
||||
One of Python's standout features is its beginner-friendly syntax, making it an ideal language for those new to programming. The emphasis on readability and the absence of complex syntax (for the most part), eases the learning curve, enabling new developers to quickly grasp fundamental concepts. |
||||
|
||||
Python's community plays a critical role in its accessibility. Abundant learning resources, tutorials, and documentation are readily available, empowering beginners to progress from basic programming principles to advanced backend development seamlessly. Online platforms like Codecademy, Coursera, realpython.com, and even Google offer comprehensive courses tailored to all skill levels. |
||||
|
||||
#### Practical Applications and Popular Frameworks |
||||
|
||||
Python's versatility is evident in its applicability across a spectrum of industries, from web development and data science to artificial intelligence and automation. In the context of backend development, Python shines brightly with its two standout frameworks: [Django](https://www.djangoproject.com/) and [Flask](https://github.com/pallets/flask). |
||||
|
||||
##### Django |
||||
|
||||
So, let's talk about Django – it's like the superhero of web frameworks, at least in the world of Python. This high-level powerhouse is all about that "batteries-included" style, giving you a whole package of tools and features that make development lightning-fast. It follows the [Model-View-Controller](https://www.crio.do/blog/understand-mvc-architecture/) (MVC) architecture that gives your web applications a solid structure, making them scalable and easy to keep up. |
||||
|
||||
Part of that whole “batteries-included” motto means that it comes with an admin panel, an [ORM](https://www.freecodecamp.org/news/what-is-an-orm-the-meaning-of-object-relational-mapping-database-tools/) (Object-Relational Mapping) for smooth data handling, and security features that make sure your project is secured out-of-the-box. All these goodies work together, making Django a top choice for projects, whether they're a walk in the park or a brain-bending challenge. |
||||
|
||||
##### Flask |
||||
|
||||
On the other hand, Flask, a micro-framework, takes a minimalist approach, providing developers with the flexibility to choose components as needed. While Flask may be lighter than Django, it doesn't compromise on functionality. Its simplicity and modularity make it an excellent choice for small to medium-sized projects, allowing developers to tailor the framework to meet specific project requirements. |
||||
|
||||
Both Django and Flask underscore Python's suitability for backend development, offering developers frameworks that cater to diverse project needs while maintaining Python's hallmark readability and efficiency. |
||||
|
||||
#### Pros and Cons of Python |
||||
|
||||
As with all other backend languages in this article, Python has some pros and cons you should consider before picking it as your first backend language. |
||||
|
||||
##### Pros |
||||
|
||||
- The syntax is very easy to learn because it’s very much like writing English. |
||||
- The ecosystem is quite mature and has some nice frameworks that will contain all the tools you need to get started |
||||
|
||||
##### Cons |
||||
|
||||
- It’s not the most popular backend language, so while the frameworks available are constantly updated, they aren’t necessarily using the latest technology trends. |
||||
- The GIL (Global Interpreter Lock) limits Python’s performance in multi-threaded applications. |
||||
|
||||
### Java |
||||
|
||||
Java has a massive presence and for good reason (according to [JetBrain’s survey in 2022, Java was used by 48% of developers](https://w3techs.com/technologies/details/pl-php)).It's the kind of programming language that's everywhere – serving up websites, running your favorite apps, and even powering big-scale enterprise systems. |
||||
|
||||
#### Is it worth learning Java? |
||||
|
||||
Now, learning Java, (a strongly typed, object oriented programming language (OOP), is a journey worth taking, but it's not a walk in the park. It's a bit like climbing a mountain – you start at the bottom with the basics, and as you ascend, you get into the nitty-gritty of things like object-oriented programming. The process will force you to learn a lot, which is a great thing, by the end you’ll have a lot of understanding of mechanics and concepts around OOP that can be extrapolated into other languages. However, that can also be overwhelming to some developers who just want to learn by building mini-projects. In those situations, the learning curve of Java might be too long (not steep, but long because there is a lot more to cover than with alternatives such as Python or JavaScript). |
||||
|
||||
That said, the community is big and there are tons of resources, from online courses to forums, helping you navigate the Java landscape. And good reason, considering Java has been around for quite a while. |
||||
|
||||
#### Use Cases and Robust Ecosystem |
||||
|
||||
Java's everywhere. From web development to mobile apps, and even diving into the world of big data, Java's got its fingerprints all over. And if it’s not the language itself, it’s the Java Virtual Machine (JVM) powering some other language, like Spark. |
||||
|
||||
Java’s the language of choice for many big enterprises given its innate robustness (the first version of the language was released in 1995, it’s had quite a long time to evolve), and its robust ecosystem of libraries and frameworks makes it a go-to for developers. |
||||
|
||||
#### Pros and Cons of Java |
||||
|
||||
For all its power and robustness, there are some negative (and positive) aspects to picking Java as your first backend language. |
||||
|
||||
##### Pros |
||||
|
||||
- Java has a mature ecosystem with a varied array of libraries and frameworks for you to try. The community has been working on them and evolving them for years in many cases, so they’re quite ready to develop enterprise-ready solutions. |
||||
- Java’s multithreading support makes it ideal for some processing-heavy tasks in the backend of big applications. |
||||
- Java’s heavy focus on object oriented programming makes it a great option for developers who enjoy that paradigm. |
||||
|
||||
##### Cons |
||||
|
||||
- Java’s verbose syntax might be a problem for some people. While you can still code without an issue, it all comes down to personal preference. If you like to write less and do more with your code, Java might not be the ideal pick for you. It’s verbosity can increase development time in some situations. |
||||
- Java applications can have higher memory consumption than others, especially compared to others like PHP. While the reason for this is their entire architecture, the fact remains. |
||||
|
||||
### JavaScript (Node.js) |
||||
|
||||
With Node.js in the mix, JavaScript becomes a lingua franca in web development. In other words, you can use the same language both for the frontend (client side) and for the backend (server side) of your application. |
||||
|
||||
That said, keep in mind that depending on the framework you’re using, while it might be JavaScript on both sides, the code and logic you use can be considerably different. |
||||
|
||||
Remember that frontend code is often confused with framework code (as in React, Angular, Vue, etc) by some developers, simply because it’s all JavaScript. But don’t be confused, the backend lacks a lot of the extra “juice” added by the browser (like the DOM API and others). |
||||
|
||||
#### Learning Advantages of Node.js |
||||
|
||||
If you've got the basics of JavaScript down, even if your experience has only been on the frontend, diving into Node.js is like leveling up. It lets you use the same language for both frontend and backend, which means less time juggling languages and more time building cool stuff. |
||||
|
||||
The event-driven, non-blocking architecture is one of the main features that make the language so special – it makes your web apps fast and efficient without you having to learn more complex concepts such as multi-threading. Plus, the community is constantly growing and there are tutorials everywhere to guide you through the Node.js universe. |
||||
|
||||
If you were to rank languages based on the amount of content out there to learn them, JavaScript would be one of the first ones (if not the first one) on the list. |
||||
|
||||
#### Key Frameworks and Development Tools |
||||
|
||||
Now, let's talk about frameworks. In the case of JavaScript, this topic is so varied that recommending a single option for someone just getting started is really hard. |
||||
|
||||
For example, if you want to go frontend agnostic, or in other words, you don’t care about the technology being used to develop the client side of your app, then a good starting option would be [Express.js](https://expressjs.com/). This framework used to be the industry standard. And while that’s no longer the case, it’s still a perfect first choice if you’re looking for something with the required functionality to make your life a lot easier. |
||||
|
||||
Now, if on the other hand, you’re looking to build the frontend and the backend at the same time, then I would recommend going with [Next.js](https://nextjs.org/) if you’re already familiar with React. Or if on the other hand, you prefer Vue.js, then definitely try [Nuxt](https://nuxt.com/). Either one of those will help you get the job done with all the bells and whistles you can think of. |
||||
|
||||
#### Does it make sense to pick up JavaScript as a backend language? |
||||
|
||||
The answer to this question is always going to be “yes”, whether you’re coming from the frontend and you already have JS experience or if you’re picking it up from scratch. In fact, according to [StackOverflow’s 2023 survey, JavaScript is the most used language by professionals](https://survey.stackoverflow.co/2023/#most-popular-technologies-language-prof) (with 65.85% of the votes). |
||||
|
||||
![JavaScript Interest](/guides/backend-languages/javascript-interest.png) |
||||
|
||||
If you’re coming from the client side, then adopting JS for your backend will let you start working in minutes. You’ll probably spend more time learning the backend-specific concepts than the language itself. |
||||
|
||||
On the other hand, if you’re coming from zero, or from other programming languages, JS has some quirks, for sure, but if you go the JS route, you’re already making way for a potential switch into the frontend in the future. Who knows, maybe in a few months you’ll also want to start working on the frontend, and by having picked up JS as your main backend language, you have 90% of the work already cut for you. |
||||
|
||||
There is really no downside to picking JS as your first backend language. |
||||
|
||||
#### Pros and Cons of JavaScript |
||||
|
||||
While there might not be a downside to picking JS, there is no perfect language out there, so let’s take a look at some of the pros and cons before moving on to the next one. |
||||
|
||||
##### Pros |
||||
|
||||
- Going with JavaScript, you’re using the same language on the backend and on the frontend. There is less cognitive load while switching environments if you’re the one coding both sides of the app. |
||||
- The ecosystem around JavaScript is one of the richest ones you can find. The community is constantly pushing the limits of the language and coming up with new solutions to everyday problems. |
||||
- The simple syntax allows you to reduce development time because you don’t have to write as much code to achieve good results. |
||||
|
||||
##### Cons |
||||
|
||||
- Asynchronous programming can be hard for some developers coming from other languages, like Python for example. |
||||
- The lack of strong types in JavaScript can cause some problems for big codebases. |
||||
- The single-thread nature of the language makes it really hard to implement CPU-intensive tasks. While there is support for multi-threading, it’s not extensive nor commonly used. |
||||
- Debugging asynchronous code can be difficult for new developers given the non-linear nature of it. |
||||
|
||||
### PHP |
||||
|
||||
Now, if you’re looking for something very well established in the web development industry, just like Java but with a shorter learning curve, then you’re probably looking for PHP. |
||||
|
||||
> As a note about PHP’s relevancy, while many developers might claim that PHP is a dying tech, according to [W3Techs, over 75% of websites with a backend use PHP](https://w3techs.com/technologies/details/pl-php). |
||||
|
||||
It's the glue that holds a ton of websites together, and its longevity in the web development scene is no accident. |
||||
|
||||
#### Ease of Mastery and Vast Library Support |
||||
|
||||
If you're diving into PHP, you wouldn’t be so wrong (no matter what others might tell you). It's got a gentle learning curve, which means you can start building things pretty quickly. Getting everything set up and working will probably take you 10 minutes, and you’ll be writing your first “hello world” 5 minutes after that. |
||||
|
||||
The vast community support and an ocean of online resources make mastering PHP a breeze. Plus, its library support is like having a toolkit that's always expanding – you'll find what you need, whether you're wrangling databases, handling forms, or making your website dance with dynamic content. |
||||
|
||||
If you’re looking to pick up PHP, look for the LAMP stack, which stands for **L**inux, **A**pache, **M**ySQL, and **P**HP. With that tech stack, you’ll have everything you need to start creating websites in no time. |
||||
|
||||
#### Modern PHP Frameworks and Their Impact |
||||
|
||||
If we’re talking about PHP frameworks, then we gotta talk about [Laravel](https://laravel.com/) and [Symfony](https://symfony.com/). They are like the rockstars of the modern PHP world. |
||||
|
||||
Laravel comes with a lot of tools and features that help you speed up your development process. On the other side, Symfony has a modular architecture, making it a solid choice for projects of all sizes. |
||||
|
||||
These frameworks showcase how PHP has evolved, staying relevant and powerful in the ever-changing landscape of web development. |
||||
|
||||
#### Pros and Cons of PHP |
||||
|
||||
Let’s take a look at some of the most common advantages of going with PHP for the backend and some cons to discuss why it might not be the best choice for you. |
||||
|
||||
##### Pros |
||||
|
||||
- PHP is designed for web development, which still makes it a very popular choice for a backend language. |
||||
- PHP’s community is quite big, considering how old the language is, so if you need help, chances are, someone has the answer you’re looking for. |
||||
|
||||
##### Cons |
||||
|
||||
- One of the major complaints developers have about the language is its inconsistent function naming convention. While not a huge problem, it makes it very hard for developers to intuitively find the right function by name. This causes you to constantly verify your code against the documentation to make sure you’re not making mistakes. |
||||
|
||||
### Go |
||||
|
||||
Now, let's close in on Go, the programming language born at Google that's all about simplicity and efficiency. Go embraces a clean and straightforward syntax. Despite its simplicity, it focuses heavily on performance, making it an excellent choice for building modern, scalable applications. |
||||
|
||||
According to the [PYPL index](https://pypl.github.io/PYPL.html) (using Google searches to weigh interest of developers in a particular language), we can see a clear worldwide growing interest in Go from the development community: |
||||
|
||||
![Go Interest](/guides/backend-languages/pypl-go-index.png) |
||||
|
||||
#### Concurrency and Scalability |
||||
|
||||
Go stands out in the crowd, especially when it comes to handling concurrency and scalability. Its built-in support for concurrent programming, through goroutines and channels, makes it a standout choice for applications that need to juggle multiple tasks simultaneously. This makes Go particularly adept at handling the demands of today's highly concurrent and distributed systems. In other words, Go is a great choice for building microservices, a type of system that is very commonly used as the backend for complex web applications. |
||||
|
||||
So yes, very relevant. |
||||
|
||||
#### Learning Curve and Developer Productivity |
||||
|
||||
Learning Go is a smooth ride, thanks to its simplicity and extensive documentation. Developers often find themselves quickly transitioning from understanding the basics to building robust applications. |
||||
|
||||
The language's focus on developer productivity is evident in its quick compilation times and the absence of excessive boilerplate code, allowing developers to concentrate on building features rather than wrestling with the language itself. |
||||
|
||||
#### Pros and Cons of Go |
||||
|
||||
Let’s take a look at some pros and cons for the last programming language on our list. |
||||
|
||||
##### Pros |
||||
|
||||
- Go code compiles quickly, which in turn leads to very fast development cycles. This is a big plus if you’re developing a big application with a large codebase because other options might slow down your process with their compilation times. |
||||
- Go's syntax is simple enough to make it easy to learn and understand for new developers. |
||||
|
||||
##### Cons |
||||
|
||||
- Go’s ecosystem is quite young when compared to the other alternatives here, so the maturity of the tools available might not be the same as, for example, Java or JavaScript tooling. |
||||
|
||||
### Choosing the Ideal Backend Language |
||||
|
||||
So, are these the best backend programming languages out there? Is there an absolute “best” backend programming language? |
||||
|
||||
As you’ve probably seen by now, there is no “perfect” or “ideal” backend language. When it comes to picking one out of the huge number of alternatives, you have to consider other aspects outside of the language itself: |
||||
|
||||
- What’s the size of your project? Are you building a large-scale platform? Or just a basic static website? |
||||
- Do you mind spending more time learning or do you need to be efficient and start coding right away? |
||||
- Do you already have some programming knowledge and would like to pick something that resembles what you already know? Or would you like to pick up something that’s entirely different? |
||||
- Are you alone? Or are you part of a team? |
||||
|
||||
Once you’ve answered those questions, you’ll probably have some idea of where to go, but then you should look into the language itself, specifically into: |
||||
|
||||
- Does it have enough learning resources for you? |
||||
- How big and active is the community around it? |
||||
- Are the main frameworks still under development? Or have they been parked for a while? |
||||
|
||||
In the end, you’re evaluating the language and its ecosystem, making sure they’re both evolving right along the web industry. If you find that there are aspects that are falling behind, then it probably isn’t a good choice. |
||||
|
||||
A handy tool when trying to evaluate a language like that is [roadmap.sh](https://roadmap.sh). |
||||
|
||||
[![Roadmap.sh](/guides/backend-languages/backend-roadmap-part.png)](https://roadmap.sh/backend) |
||||
|
||||
<p align="center" style="font-size: 14px; margin-top: -10px; text-align: center">Small section of the full backend roadmap available on <a href="https://roadmap.sh/backend">roadmap.sh</a></p> |
||||
|
||||
There you’ll find community-maintained roadmaps for many career paths within software development. In particular, for this article, the [backend roadmap](https://roadmap.sh/backend) is a great place to start, because while picking a backend language is important, you’ll see there that it’s not just about the language. In fact, there is a lot of tech around the language that is also required (I’m referring to databases, git, understanding how client-server communication works, and a big “etc). |
||||
|
||||
### Jumpstarting Your Backend Development Journey |
||||
|
||||
To get started with your backend development journey, it's crucial to have a roadmap that guides you through the learning process and equips you with the skills to build robust and scalable backend systems. |
||||
|
||||
Lucky for you, if you’re reading this, that means you’ve found the most complete and comprehensive roadmap online: [roadmap.sh](https://roadmap.sh), the current [backend roadmap](https://roadmap.sh/backend) is filled with details of everything you should and could (optionally) learn in your journey to becoming a backend developer. |
||||
|
||||
### Guided Learning: From Online Courses to Bootcamps |
||||
|
||||
Online courses and bootcamps serve as invaluable companions on your learning expedition. Platforms like Udemy, Coursera, and freeCodeCamp offer comprehensive backend development courses. |
||||
|
||||
These resources not only cover programming languages like Python, Java, or JavaScript but also dive deep into frameworks like Django, Express.js, or Laravel. For those seeking a more immersive experience, coding bootcamps provide intensive, hands-on training to fast-track your backend development skills. |
||||
|
||||
Whatever choice you go for, make sure you’re not following trends or just copying the learning methods of others. Learning is a very personal experience and what works for others might not work for you, and vice versa. So make sure to do the proper research and figure out what option works best for you. |
||||
|
||||
### Building Community Connections for Learning Support |
||||
|
||||
Joining developer communities (there are several on Twitter for example), forums like Stack Overflow, or participating in social media groups dedicated to backend development creates a network of support. |
||||
|
||||
Engaging with experienced developers, sharing challenges, and seeking advice fosters a collaborative learning environment. Attend local meetups or virtual events if you can to connect with professionals in the field, gaining insights and building relationships that can prove invaluable throughout your journey. |
||||
|
||||
### Think about you and your project |
||||
|
||||
There are many ways to go about picking the ideal backend language for you. If there is anything you should take home with you after reading this article, it is that most languages are equivalent in the sense that you’ll be able to do pretty much everything with any of them. |
||||
|
||||
So what criteria can you use to pick the “right one” for you? |
||||
|
||||
The questions you should also be asking yourself are: |
||||
|
||||
- What’s your preference for a language? Do you like Object Oriented Programming (OOP) or are you more of a functional programming type of dev? Do you like statically typed programming languages or loosely typed ones? Personal preferences should also play an important role at the time of picking your ideal programming language. |
||||
- What does my project need? After all, project requirements sometimes dictate technology. Keep that in mind, check if the project’s needs and your personal preferences align, and try to weigh in pros and cons if they don’t. |
||||
|
||||
In the end, personal preference and actual project requirements (if you have any) are very important, because both will influence how much you enjoy (or don’t enjoy) the learning process. |
||||
|
||||
### Crafting a Portfolio to Display Your Backend Skills: |
||||
|
||||
As you accumulate skills and knowledge, showcase your journey through a well-crafted portfolio. Include projects that highlight your backend skills, demonstrating your ability to - design databases, implement server-side logic, and integrate with client side technologies. Whether it's a dynamic web application, a RESTful API, or a data-driven project, your portfolio becomes a tangible representation of your backend development capabilities for potential employers or collaborators. |
||||
|
||||
When it comes to deciding where to publish this portfolio, you have some options, such as directly on your GitHub profile (if you have one), or perhaps on your own personal website where you can share some design thoughts about each project along with the code. |
||||
|
||||
In the end, the important thing is that you should be sharing your experience somewhere, especially when you don’t have working experience in the field. |
||||
|
||||
### Conclusion |
||||
|
||||
In the end, there are many backend programming languages to choose from, and what language you go for, is up to you and your particular context/needs. All I can do is guide you to the door, but you have to cross it yourself. Some interesting options are: |
||||
|
||||
- Python with its English-like syntax. |
||||
- Java with its formal syntax and enterprise support. |
||||
- JavaScript with its flexibility and ability to jump between frontend and backend. |
||||
- PHP with its proven record of success. |
||||
- And Go, with its performance and scalability focus. |
||||
|
||||
You’re the one who gets to decide, but just know that no matter what you choose, getting started in backend development is a one-way street. You’ll be learning from this moment on, and you’ll be jumping from one language to the other as the field evolves. |
||||
|
||||
Remember that there is a very detailed version of a [backend roadmap here](https://roadmap.sh/backend), it might be a great place to get started! And if you’re also interested in frontend development, there is an [equally handy roadmap](https://roadmap.sh/frontend) here as well! |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,17 @@ |
||||
CommonJS and ES Modules are two different module systems in JavaScript. CommonJS is the module system used in Node.js, while ES Modules are the module system used in browsers and TypeScript. |
||||
|
||||
## CommonJS |
||||
|
||||
```js |
||||
const fs = require('fs'); |
||||
``` |
||||
|
||||
CommonJS modules are loaded synchronously. This means that the module is loaded and evaluated before the code using the module is executed. It uses `require()` to load modules and `module.exports` to export modules. |
||||
|
||||
## ES Modules |
||||
|
||||
```js |
||||
import fs from 'fs'; |
||||
``` |
||||
|
||||
ES Modules are loaded asynchronously. This means that the module is loaded and evaluated when the module is used. It uses `import` to load modules and `export` to export modules. |
@ -0,0 +1,66 @@ |
||||
There are four fundamental strategies to report errors in Node.js: |
||||
|
||||
## `try...catch` blocks |
||||
|
||||
`try...catch` blocks are the most basic way to handle errors in JavaScript. They are synchronous and can only be used to handle errors in synchronous code. They are not suitable for asynchronous code, such as callbacks and promises. |
||||
|
||||
```js |
||||
import fs from 'node:fs'; |
||||
|
||||
try { |
||||
const data = fs.readFileSync('file.md', 'utf-8'); |
||||
console.log(data); |
||||
} catch (err) { |
||||
console.error(err); |
||||
} |
||||
``` |
||||
|
||||
## Callbacks |
||||
|
||||
Callbacks are the most common way to handle errors in asynchronous code. They are passed as the last argument to a function and are called when the function completes or fails. |
||||
|
||||
```js |
||||
import fs from 'node:fs'; |
||||
|
||||
fs.readFile('file.md', 'utf-8', (err, data) => { |
||||
if (err) { |
||||
console.error(err); |
||||
return; |
||||
} |
||||
|
||||
console.log(data); |
||||
}); |
||||
``` |
||||
|
||||
## Promises |
||||
|
||||
Promises are a more modern way to handle errors in asynchronous code. They are returned by functions and can be chained together. They are resolved when the function completes and rejected when it fails. |
||||
|
||||
```js |
||||
import fs from 'node:fs/promises'; |
||||
|
||||
fs.readFile('file.md', 'utf-8') |
||||
.then((data) => { |
||||
console.log(data); |
||||
}) |
||||
.catch((err) => { |
||||
console.error(err); |
||||
}); |
||||
``` |
||||
|
||||
## Event emitters |
||||
|
||||
Event emitters are a more advanced way to handle errors in asynchronous code. They are returned by functions and emit an `error` event when they fail. They are resolved when the function completes and rejected when it fails. |
||||
|
||||
```js |
||||
import fs from 'node:fs'; |
||||
|
||||
const reader = fs.createReadStream('file.md', 'utf-8'); |
||||
reader.on('data', (data) => { |
||||
console.log(data); |
||||
}); |
||||
|
||||
reader.on('error', (err) => { |
||||
console.error(err); |
||||
}); |
||||
``` |
@ -0,0 +1,18 @@ |
||||
The following exit codes are used in Node.js: |
||||
|
||||
- `0`: Success |
||||
- `1`: Uncaught Fatal Exception |
||||
- `2`: Unused |
||||
- `3`: Internal JavaScript Parse Error |
||||
- `4`: Internal JavaScript Evaluation Failure |
||||
- `5`: Fatal Error |
||||
- `6`: Non-function Internal Exception Handler |
||||
- `7`: Internal Exception Handler Run-Time Failure |
||||
- `8`: Unused |
||||
- `9`: Invalid Argument |
||||
- `10`: Internal JavaScript Run-Time Failure |
||||
- `12`: Invalid Debug Argument |
||||
- `13`: Uncaught Exception |
||||
- `14`: Unhandled Promise Rejection |
||||
- `15`: Fatal Exception |
||||
- `16`: Signal Exits |
@ -0,0 +1,18 @@ |
||||
In order to take user input from the command line, you can use the `readline` module. It provides an interface for reading data from a Readable stream (such as `process.stdin`) one line at a time. |
||||
|
||||
```js |
||||
import readline from 'node:readline'; |
||||
import { stdin as input, stdout as output } from 'node:process'; |
||||
|
||||
const rl = readline.createInterface({ input, output }); |
||||
|
||||
rl.question('What do you think of Node.js? ', (answer) => { |
||||
console.log(`Thank you for your valuable feedback: ${answer}`); |
||||
rl.close(); |
||||
}); |
||||
|
||||
rl.on('close', () => { |
||||
console.log('\nBYE BYE !!!'); |
||||
process.exit(0); |
||||
}); |
||||
``` |
@ -0,0 +1,25 @@ |
||||
Order priorities of `process.nextTick`, `Promise`, `setTimeout` and `setImmediate` are as follows: |
||||
|
||||
1. `process.nextTick`: Highest priority, executed immediately after the current event loop cycle, before any other I/O events or timers. |
||||
2. `Promise`: Executed in the microtask queue, after the current event loop cycle, but before the next one. |
||||
3. `setTimeout`: Executed in the timer queue, after the current event loop cycle, with a minimum delay specified in milliseconds. |
||||
4. `setImmediate`: Executed in the check queue, but its order may vary based on the system and load. It generally runs in the next iteration of the event loop after I/O events. |
||||
|
||||
```js |
||||
console.log('start'); |
||||
Promise.resolve().then(() => console.log('Promise')); |
||||
setTimeout(() => console.log('setTimeout'), 0); |
||||
process.nextTick(() => console.log('process.nextTick')); |
||||
setImmediate(() => console.log('setImmediate')); |
||||
console.log('end'); |
||||
|
||||
// Output: |
||||
// start |
||||
// end |
||||
// process.nextTick |
||||
// Promise |
||||
// setTimeout |
||||
// setImmediate |
||||
``` |
||||
|
||||
In summary, the order of execution is generally `process.nextTick` > `Promise` > `setTimeout` > `setImmediate`. However, keep in mind that the behavior may vary in specific situations, and the order might be influenced by factors such as system load and other concurrent operations. |
@ -0,0 +1,15 @@ |
||||
`process.argv` is an array containing the command-line arguments passed when the Node.js process was launched. The first element is the path to the Node.js executable, the second element is the path to the JavaScript file being executed, and the remaining elements are the command-line arguments. |
||||
|
||||
```js |
||||
node index.js hello world |
||||
``` |
||||
|
||||
```js |
||||
console.log(process.argv); |
||||
// [ |
||||
// '/usr/local/bin/node', -> path to the Node.js executable |
||||
// '/Users/username/projects/nodejs/index.js', -> path to the JavaScript file being executed |
||||
// 'hello', -> command-line argument |
||||
// 'world' -> command-line argument |
||||
// ] |
||||
``` |
@ -0,0 +1,9 @@ |
||||
`process.cwd()` returns the current working directory of the Node.js process, while `__dirname` returns the directory name of the current module. |
||||
|
||||
```js |
||||
console.log(process.cwd()); |
||||
// /Users/username/projects/nodejs |
||||
|
||||
console.log(__dirname); |
||||
// /Users/username/projects/nodejs/src |
||||
``` |
@ -0,0 +1,14 @@ |
||||
To create a minimal `Hello, World!` HTTP server in Node.js, you can use the `http` module. It provides an HTTP server, and the createServer() method sets up a server instance with a callback function to handle incoming requests |
||||
|
||||
```js |
||||
import http from 'node:http'; |
||||
|
||||
const server = http.createServer((req, res) => { |
||||
res.writeHead(200, { 'Content-Type': 'text/plain' }); |
||||
res.end('Hello World\n'); |
||||
}); |
||||
|
||||
server.listen(3000, () => { |
||||
console.log('Server running at http://localhost:3000/'); |
||||
}); |
||||
``` |
@ -0,0 +1,227 @@ |
||||
--- |
||||
order: 1 |
||||
briefTitle: 'Node.js' |
||||
briefDescription: 'Test, rate and improve your Node.js knowledge with these questions.' |
||||
title: 'Node.js Questions' |
||||
description: 'Test, rate and improve your Node.js knowledge with these questions.' |
||||
isNew: true |
||||
seo: |
||||
title: 'Node.js Questions' |
||||
description: 'Curated list of Node.js questions to test, rate and improve your knowledge. Questions are based on real world experience and knowledge.' |
||||
keywords: |
||||
- 'node.js quiz' |
||||
- 'node.js questions' |
||||
- 'node.js interview questions' |
||||
- 'node.js interview' |
||||
- 'node.js test' |
||||
sitemap: |
||||
priority: 1 |
||||
changefreq: 'monthly' |
||||
questions: |
||||
- question: What is Node.js? |
||||
answer: Node.js is an open-source and cross-platform JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What is REPL in Node.js? |
||||
answer: | |
||||
REPL stands for Read-Eval-Print-Loop. It is an interactive shell that allows you to execute JavaScript code and view the output immediately. It is useful for testing small snippets of code and experimenting with the Node.js API. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What is the difference between Node.js and JavaScript? |
||||
answer: Node.js is a runtime environment for JavaScript. JavaScript is a programming language used to create web applications. Node.js is a runtime environment that can execute JavaScript code outside of a web browser. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What is Event Loop in Node.js? |
||||
answer: | |
||||
The event loop is a single-threaded loop responsible for handling all asynchronous tasks in Node.js. It continuously checks for events and executes associated callback functions, allowing Node.js to handle asynchronous tasks efficiently. Its non-blocking I/O model ensures that it can process multiple operations simultaneously without waiting for one to complete before moving on to the next, contributing to its scalability and performance. [Watch this video](https://www.youtube.com/watch?v=8aGhZQkoFbQ) to learn more about the topic. |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is the difference between Node.js and AJAX? |
||||
answer: | |
||||
Node.js is a server-side runtime for JavaScript, while AJAX is a client-side technique for asynchronous communication with the server. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What are modules in Node.js? |
||||
answer: | |
||||
Modules are reusable blocks of code that can be imported into other files. They are used to encapsulate related code into a single unit of code that can be used in other parts of the program. It allow us to split our code into multiple files and reuse it across multiple files. Some built-in modules include `fs`, `http`, `path`, `url`, `util`, etc. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: Difference between CommonJS and ESM? |
||||
answer: commonjs-vs-esm.md |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is the `global` object in Node.js? |
||||
answer: | |
||||
The `global` object is a global namespace object that contains all global variables, functions, and objects. It is similar to the `window` object in the browser. It can be accessed from anywhere in the program without importing it. |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is the difference between `process.nextTick()` and `setImmediate()`? |
||||
answer: | |
||||
`process.nextTick()` and `setImmediate()` are both used to schedule a callback function to be executed in the next iteration of the event loop. The difference is that `process.nextTick()` executes the callback at the end of the current iteration of the event loop, while `setImmediate()` executes the callback at the beginning of the next iteration of the event loop. |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is `setInterval()`? |
||||
answer: | |
||||
`setInterval()` is a global function that helps you execute a function repeatedly at a fixed delay. It returns an interval ID that uniquely identifies the interval, which can be used to cancel the interval using the `clearInterval()` function. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What is `setTimeout()`? |
||||
answer: | |
||||
`setTimeout()` is a global function that helps you execute a function after a specified delay. It returns a timeout ID that uniquely identifies the timeout, which can be used to cancel the timeout using the `clearTimeout()` function. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What are Event Emitters in Node.js? |
||||
answer: | |
||||
Event Emitters is a class that can be used to emit named events and register listeners for those events. It is used to handle asynchronous events in Node.js. |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is `npm`? |
||||
answer: | |
||||
`npm` is a package manager for Node.js. It is used to install, update, and remove packages from the Node.js ecosystem. It is also used to manage dependencies for Node.js projects. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What is the full form of `npm`? |
||||
answer: | |
||||
`npm` stands for Node Package Manager. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What is `npx`? |
||||
answer: | |
||||
`npx` is a tool that allows you to run Node.js packages without installing them. It is used to execute Node.js packages that are not installed globally. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What is `process.cwd()`? |
||||
answer: | |
||||
`process.cwd()` returns the current working directory of the Node.js process. It is similar to `pwd` in Unix. |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is the difference between `process.cwd()` and `__dirname`? |
||||
answer: process-cwd-vs-dirname.md |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is `__filename`? |
||||
answer: | |
||||
`__filename` is a global variable that contains the absolute path of the current file. |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is `process.argv`? |
||||
answer: process-argv.md |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is the purpose of `fs` module? |
||||
answer: | |
||||
The File System (fs) module is used to perform file operations such as reading, writing, and deleting files. All file system operations have synchronous and asynchronous forms. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What is the purpose of `path` module? |
||||
answer: | |
||||
The Path module is used to perform operations on file and directory paths. It provides methods for resolving and normalizing paths, joining paths, and extracting file and directory names. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: How to read a file in Node.js? |
||||
answer: | |
||||
The `fs.readFile()` method is used to read the contents of a file asynchronously. It takes the path of the file to be read and a callback function as arguments. The callback function is called with two arguments, `err` and `data`. If an error occurs while reading the file, the `err` argument will contain the error object. Otherwise, the `data` argument will contain the contents of the file. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: How to load environment variables from a `.env` file in Node.js? |
||||
answer: | |
||||
The `dotenv` package is used to load environment variables from a `.env` file into `process.env`. It is used to store sensitive information such as API keys, database credentials, etc. in a `.env` file instead of hardcoding them in the source code. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: How to access environment variables in Node.js? |
||||
answer: | |
||||
Environment variables can be accessed using the `process.env` object. It is an object that contains all the environment variables defined in the current process. |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: How to take user input from the command line in Node.js? |
||||
answer: input-from-command-line.md |
||||
topics: |
||||
- 'CLI' |
||||
- 'Beginner' |
||||
- question: How to create a web server in Node.js? |
||||
answer: web-server.md |
||||
topics: |
||||
- 'Core' |
||||
- 'Beginner' |
||||
- question: What are streams in Node.js? |
||||
answer: | |
||||
Streams are objects that allow you to read data from a source or write data to a destination in a continuous manner. They are used to handle large amounts of data efficiently. |
||||
topics: |
||||
- 'Core' |
||||
- 'Advanced' |
||||
- question: What is difference between `fork` and `spawn` methods of `child_process` module? |
||||
answer: | |
||||
The `fork` method is used when you want to run another JavaScript file in a separate worker. It's like having a friend with a specific task. You can communicate with them via messages and they can send messages back to you. The `spawn` method is used when you want to run a command in a separate process. It's like asking someone to do a specific. You can communicate with them via stdin/stdout/stderr, but it's more like giving orders and getting results. |
||||
topics: |
||||
- 'Core' |
||||
- 'Advanced' |
||||
- question: What is the `os` module? |
||||
answer: | |
||||
The `os` module provides methods for interacting with the operating system. It can be used to get information about the operating system, such as the hostname, platform, architecture, etc. |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: Can you access the DOM in Node.js? |
||||
answer: | |
||||
No, you cannot access the DOM in Node.js because it does not have a DOM. It is a server-side runtime for JavaScript, so it does not have access to the browser's DOM. |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is Clustering in Node.js? |
||||
answer: | |
||||
Clustering is a technique used to distribute the load across multiple processes. It is used to improve the performance and scalability of Node.js applications. |
||||
topics: |
||||
- 'Core' |
||||
- 'Advanced' |
||||
- question: How can memory leaks happen in Node.js? |
||||
answer: | |
||||
Memory leaks happen when a program allocates memory but does not release it when it is no longer needed. This can happen due to bugs in the program or due to the way the program is designed. In Node.js, memory leaks can happen due to the use of closures, circular references, and global variables. |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is the order priority of `process.nextTick`, `Promise`, `setTimeout`, and `setImmediate`? |
||||
answer: order-priority.md |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: What is `process.exit()`? |
||||
answer: | |
||||
`process.exit()` is a method that can be used to exit the current process. It takes an optional exit code as an argument. If no exit code is specified, it defaults to 0. |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: Different exit codes in Node.js? |
||||
answer: exit-codes.md |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
- question: How Node.js handle errors? |
||||
answer: error-handling.md |
||||
topics: |
||||
- 'Core' |
||||
- 'Intermediate' |
||||
--- |
@ -1,3 +1,9 @@ |
||||
# What is and how to use Gradle? |
||||
|
||||
**Using Gradle**: Gradle is a powerful build system used in Android development that allows you to define your project and dependencies, and distinguish between different build types and flavors. Gradle uses a domain-specific language (DSL) which gives developers almost complete control over the build process. When you trigger a build in Android Studio, Gradle is the tool working behind the scenes to compile and package your app. It looks at the dependencies you declared in your build.gradle files and creates a build script accordingly. Using Gradle in android development requires continuous editing of the build.gradle files to manage app dependencies, build variants, signing configurations and other essential aspects related to building your app. |
||||
**Using Gradle**: Gradle is a powerful build system used in Android development that allows you to define your project and dependencies, and distinguish between different build types and flavors. Gradle uses a domain-specific language (DSL) which gives developers almost complete control over the build process. When you trigger a build in Android Studio, Gradle is the tool working behind the scenes to compile and package your app. It looks at the dependencies you declared in your build.gradle files and create a build script accordingly. Using Gradle in Android development requires continuous editing of the build.gradle files to manage app dependencies, build variants, signing configurations, and other essential aspects related to building your app. |
||||
|
||||
Visit the following resources to learn more: |
||||
|
||||
- [Introduction to Gradle for Complete Beginners - 25minutes](https://youtu.be/-dtcEMLNmn0?si=NuIP-3wNpUrxfTxA) |
||||
- [Gradle Course for Beginners - 55minutes](https://www.youtube.com/watch?v=R6Z-Sxb837I) |
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,9 @@ |
||||
# Javascript Versions |
||||
|
||||
JavaScript was invented by Brendan Eich, and in 1997 it became an ECMA standard. ECMAScript is the official language name. ECMAScript versions include ES1, ES2, ES3, ES5, and ES6 |
||||
JavaScript, invented by Brendan Eich, achieved the status of an ECMA standard in 1997 and adopted the official name ECMAScript. This language has evolved through several versions, namely ES1, ES2, ES3, ES5, and the transformative ES6. These updates have played a crucial role in improving and standardizing JavaScript, making it widely used and valuable in the ever-changing field of web development. |
||||
|
||||
Visit the following resources to learn more: |
||||
|
||||
- [JavaScript Versions: How JavaScript has changed over the years](https://www.educative.io/blog/javascript-versions-history) |
||||
- [Brief History of JavaScript](https://roadmap.sh/guides/history-of-javascript) |
||||
- [JavaScript Version](https://www.w3schools.com/js/js_versions.asp) |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue