node.js: How to use express.js

mkdir URL_req
npm init
touch express.js
npm install express -save
var express = require('express');var app = express();app.get('/',function(req, res) {res.send("Technology's Store");});app.get('/laptops',function(req,res){res.send("Laptops Category");});app.get('/smartphones',function(req,res){res.send("Smartphones Category");});app.get('/tablets',function(req,res){res.send("Tablets Category");});app.listen(8088,function(){console.log("Servidor ativo no porto 8088");});
node express.js
http://localhost:8088/
http://localhost:8088/laptops
http://localhost:8088/smartphones
http://localhost:8088/tablets

--

--

--

Finalist student in Computer Engineering

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Functional Programming: Using the Functor Type Class in TypeScript

What Developers Should Look Out for in a Programming Contract

Styled Components for Everyone — Welcome Cinnamon Wrap 1.0 🌯

Popular JavaScript Array Functions

As a Programmer, How Many Languages Do You Need To Learn?

Essential Node.js Libraries I Can’t Live Without as a Developer

Some important String methods of JavaScript every Web Seveloper needs to know

How to Implement Experience Targeting in AEM using ContextHub?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Afonso Antunes

Afonso Antunes

Finalist student in Computer Engineering

More from Medium

Axios Library - HTTP Requests

Implement Email-Password Authentication in React using MongoDB Realm

Node Js For Web Development

I can’t install react using npx create-react-app. Here’s the solution — Let Me Fail