Making Server with node and Express


$ npm install
$ npm install express

Express Code

const express = require(‘express’);const bodyParser = require(‘body-parser’);const cors = require(‘cors’);const app = express();let users = [];app.use(cors());app.use(bodyParser.urlencoded({extended:true}));app.use(bodyParser.json());'/user',(req,res) =>{const user =req.body;console.log(user);users.push(user);res.send('user is added to the database');});app.listen(3001,()=>console.log('connected to port 3001'))

The HTML File

<!DOCTYPE html>
<head><title>Login Screen</title></head>
<div class = “Login-box”>
<h1>&nbsp; Login</h1>
<form action=”http://localhost:3001/user" method=”POST”><div class=”textbox”></div>
<input type=”text” name=”username” placeholder=”User name”>
<div class=”textbox”></div>
<input type=”password” name=”Password” placeholder=”Password”><br>
<button type=”submit” class=”bton”>Submit</button></br></form>


React Native Developer | UI/UX Designer | Python |Tableau |AR |Arduino #IOSdeveloper

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