I currently have a project created asp.net MVC in C # and I wanted to add code from Node.js.
Download the Node.js from the package nuget and install it by creating a .bin folder containing node.cmd in the project
I have the following code in the view that has the cshtml extension and wanted to start testing the node.js code:
<!DOCTYPE html>
<html>
<head runat="server">
<meta name="viewport" content="width=device-width" />
<title>Login</title>
<script src="../../Scripts/jquery-3.1.1.min.js"></script>
<script src="../../Scripts/bootstrap.min.js"></script>
<link href="../../Content/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script>
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello World!');
}).listen(8080);
</script>
</head>
<body>
//codigo de razor , C# html, etc
</body>
</html>
I wanted to try the code, but it does not work. The truth is that I have not worked with Node.js, and that's why I wanted to start learning and incorporate it into my already created project. What should I do to make Node.js work in my asp.net MVC project in Visual Studio? Greetings