Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 21

EXPRESS ,TYPE

SCRIPT,
ANGULAR JS
EXPRESS.JS

• Express.js is a small framework that works on top of Node.js web


server functionality to simplify its APIs and add helpful new
features.
• It makes it easier to organize your application’s functionality with
middleware and routing. It adds helpful utilities to Node.js HTTP
objects and facilitates the rendering of dynamic HTTP objects.
TYPE SCRIPT
• TypeScript is a strongly typed programming language that builds on
JavaScript, giving you better tooling at any scale.
• TypeScript adds additional syntax to JavaScript to support a tighter
integration with your editor. Catch errors early in your editor.
• TypeScript code converts to JavaScript, which runs anywhere JavaScript
runs: In a browser, on Node.js or Deno and in your apps.
• TypeScript understands JavaScript and uses type inference to give you great
tooling without additional code.
ANGULAR JS
• AngularJS extends HTML with new attributes.
• AngularJS is perfect for Single Page Applications (SPAs).
• AngularJS is easy to learn.
• HTML is great for declaring static documents, but it falters when we
try to use it for declaring dynamic views in web-applications.
AngularJS lets you extend HTML vocabulary for your application.
The resulting environment is extraordinarily expressive, readable,
and quick to develop.
EXPRESS.JS

• Express is a popular and powerful web application framework for Node.js that allows
developers to easily build robust and scalable web applications.
• It is a minimalist framework that provides a variety of features and functions for
developing web applications quickly and efficiently.
• Developers widely use Express because of its flexibility, ease of use, and powerful
features.
• Express.js provides a simple and flexible routing system, middleware functions,
templates, and error-handling features, making it easy to build complex web
applications. It is also compatible with a variety of databases, making it an ideal choice
for building web applications that require database connectivity.
• Express.js is built on top of Node.js, which means that it can take advantage of all the
features and functions of Node.js, including its speed and scalability.
WHAT IS EXPRESS.JS USED FOR?
• Single-page applications (SPAs):
Express.js can be used to build SPAs, which are web applications that provide a seamless
user experience by loading all the necessary resources on a single page.
• Mobile applications:
Express.js can be used to build mobile applications that use web technologies like HTML, CSS, and JavaScript.
• RESTful APIs:
Express.js is commonly used to build RESTful APIs that can be used by other applications to access and
manipulate data.
• Server-side rendering:
Express.js can be used for server-side rendering, which is the process of rendering web pages on the server
before sending them to the client.
• Real-time applications:
Express.js can be used to build real-time applications, which require constant communication between the
client and server.
• Microservices:
Express.js is also used for building microservices, which are small, independent services that can be combined
to build a larger application.
• Routing: KEY FEATURES OF EXPRESS JS
Express.js provides a simple and flexible routing system that allows
developers to map HTTP requests to specific functions.
• Middleware:
Express.js provides middleware functions that can be used to perform various operations on incoming
requests and outgoing responses. Middleware functions can be used to add functionality to your
application, such as authentication, error handling, and more.
• Templates:
Express.js provides a variety of template engines that can be used to render HTML pages. It supports
popular template engines like EJS, Handlebars, and Pug.
• Error Handling:
Express.js provides robust error handling features that help developers handle errors and exceptions in
their applications.
• Security:
Express.js provides built-in security features like Helmet, which helps protect against common security
vulnerabilities like cross-site scripting (XSS) and cross-site request forgery (CSRF).
• Easy to Use:
Express.js is easy to use and requires minimal configuration, making it ideal for developers who want to
build web applications quickly.
INSTALL
EXPRESS.JS
• already installed Node.js
• npm init command to create a package.json file for your application.

• Now install Express in the myapp directory and save it in the


dependencies list. For example:
$ npm install express
REQUEST & RESPONSE
• Express application uses a callback function whose parameters
app.get('/', function (req, res) { //
are request and response objects. -- })
• Request Object − The request object represents the HTTP request and
has properties for the request query string, parameters, body, HTTP
headers, and so on.
• Response Object − The response object represents the HTTP response
that an Express app sends when it gets an HTTP request.
• You can print req and res objects which provide a lot of information
related to HTTP request and response including cookies, sessions,
URL, etc.
BASIC ROUTING

• Basic application which


serves HTTP request for
the homepage. Routing
refers to determining how
an application responds to
a client request to a
particular endpoint, which
is a URI (or path) and a
specific HTTP request
method (GET, POST, and
so on).
GET METHOD
• Here is a simple example which passes two values using HTML FORM GET method.
We are going to use process_get router inside server.js to handle this input.
POST METHOD

• Here is a simple example which passes two values using HTML FORM
POST method. We are going to use process_get router inside server.js
to handle this input.
EXPRESS JS REQUEST & RESPONSE
• Request and Response object both are the callback function parameters and are used for

Express.js and Node.js. You can get the request query, params, body, headers, and cookies. It

can overwrite any value or anything there. However, overwriting headers or cookies will not

affect the output back to the browser.

• Request object

• Express.js is a request & response objects parameters of the callback function and are used for

the Express applications. The request object represents the HTTP request and contains

properties for the request query string, parameters, body, HTTP headers, etc.

• Syntax : app.get(‘/’, function (req, res) { })


RESPONSE OBJECT
• The response object specifies the HTTP response when an Express app gets an
HTTP request. The response is sent back to the client browser and allows you to
set new cookies value that will write to the client browser.
TYPE SCRIPT
• Strongly typed, object oriented, compiled language.
• By Anders Hejlsberg (designer of C#) at Microsoft.
• typed superset of JavaScript compiled to JavaScript.
Features of TypeScript
TypeScript is just JavaScript. TypeScript starts with JavaScript and ends with JavaScript. Typescript
adopts the basic building blocks of your program from JavaScript. Hence, you only need to know
JavaScript to use TypeScript. All TypeScript code is converted into its JavaScript equivalent for the
purpose of execution.
TypeScript supports other JS libraries. Compiled TypeScript can be consumed from any JavaScript
code. TypeScript-generated JavaScript can reuse all of the existing JavaScript frameworks, tools, and
libraries.
JavaScript is TypeScript. This means that any valid .js file can be renamed to .ts and compiled with
other TypeScript files.
TypeScript is portable. TypeScript is portable across browsers, devices, and operating systems. It can
run on any environment that JavaScript runs on. Unlike its counterparts, TypeScript doesn’t need a
dedicated VM or a specific runtime environment to execute.
COMPONENTS OF TYPESCRIPT
• Language − It comprises of the syntax, keywords, and
type annotations.
• The TypeScript Compiler − The TypeScript compiler
(tsc) converts the instructions written in TypeScript to its
JavaScript equivalent.
• The TypeScript Language Service − The "Language
Service" exposes an additional layer around the core
compiler pipeline that are editor-like applications. The
language service supports the common set of a typical
editor operations like statement completions, signature
help, code formatting and outlining, colorization, etc.
INSTALL TYPESCRIPT
HOW TO WRITE TYPESCRIPT PROGRAM
• Download link : https://code.visualstudio.com/
CREATE
TYPESCRIPT

• Compiling the myfirstprog.ts the myfirstprog.js

• Include myfirstprog.js into


HTML code
OUTPUT:
• Open some web browser and enter the path of the file as URL, right click on browser
window .
• Select Inspect -> Console . The output can be viewed on console window,

You might also like