Last active
December 28, 2017 16:23
-
-
Save riccardopirani/b06b98ab9b41c70170e2a8e41bf1e13d to your computer and use it in GitHub Desktop.
how to extrapolate the parameters of the Json request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Correctly Version | |
//Import the necessary libraries/declare the necessary objects | |
var express = require("express"); | |
var myParser = require("body-parser"); | |
var app = express(); | |
//Login | |
app.use(myParser.urlencoded({extended : true})); | |
app.post("/login", function(request, response) { | |
var data = JSON.parse(Object.keys(request.body)[0]); | |
var username = data.Username; | |
var password = data.Password; | |
console.log(username); | |
console.log(password); | |
}); | |
//Application Listen on Port | |
app.listen(3000,function(){ | |
console.log("Application Server Start on Port: 3000"); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment