Skip to content

bali-dev-camp/01-express-101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic Express 101

Step-step

  1. Make new folder.
mkdir 01-express-101
  1. Open the folder.
cd 01-express-101
  1. Make sure you have node and npm installed in your computer.
node -v
npm -v
  1. Init npm for start the project.
npm init
  1. For now, just press enter if you asked to fill something. If done, file package.json will appeared in your directory.
{
  "name": "01-express-101",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}
  1. Install the express
npm install express
  1. Create new file index.js
touch index.js
  1. Copy this script.
const express = require("express");

const app = express();

app.use(express.json());
app.use(express.urlencoded({ extended: true }));

app.get("/", (req, res) => {
  res.send("Hello Express");
});

app.listen(3000, () => {
  console.log("Running on localhost:3000");
});
  1. Try to run the script, and open localhost:3000.
node index.js
  1. Improve your script!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published