Empezando con express

npm i express

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  res.send('Hello World!');
});

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
});

The general syntax for a route is shown below

app.METHOD(PATH, HANDLER)
Wherein,

1) app is an instance of the express module

2) METHOD is an HTTP request method (GET, POST, PUT or DELETE)

3) PATH is a path on the server.

4) HANDLER is the function executed when the route is matched

var express = require('express');
var app = express();
app.route('/Node').get(function(req,res)
{
    res.send("Tutorial on Node");
});
app.route('/Angular').get(function(req,res)
{
    res.send("Tutorial on Angular");
});
app.get('/',function(req,res){
    res.send('Welcome to Guru99 Tutorials');
}));
app.get("/items/:vegetable", (req, res) => {
let veg = req.params.vegetable;
res.send(`This is the page for ${veg}`);
});

middleware:

app.use((req, res, next) => {
console.log(`request made to: ${req.url}`);
next();
});
// An example middleware function
var a_middleware_function = function(req, res, next) {
  // ... perform some operations
  next(); // Call next() so Express will call the next middleware function in the chain.
}

// Function added with use() for all routes and verbs
app.use(a_middleware_function);

// Function added with use() for a specific route
app.use('/someroute', a_middleware_function);

// A middleware function added for a specific HTTP verb and route
app.get('/', a_middleware_function);

Para archivos estáticos:

app.use(express.static('public'));

Servidor muy sencillo

const routeResponseMap = {
  "/info": "<h1>Info Page</h1>",
  "/contact": "<h1>Contact Us</h1>",
  "/about": "<h1>Learn More About Us.</h1>",
  "/hello": "<h1>Say hello by emailing us here</h1>",
  "/error": "<h1>Sorry the page you are looking for is not here.</h1>"
};

const port = 3000,
  http = require("http"),

  app = http.createServer((req, res) => {
    res.writeHead(200, {
      "Content-Type": "text/html"
    });
    if (routeResponseMap[req.url]) {
      res.end(routeResponseMap[req.url]);
    } else {
      res.end("<h1>Welcome!</h1>");
    }
  });
app.listen(port);
console.log(`The server has started and is listening on port number:${port}`);

Chat: un ejemplo

Necesitamos instalar express y socket:

npm i express

npm i socket.io

 

server.js


var app = require('express')();
var http = require('http').createServer(app);
var io = require('socket.io')(http);

app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});

io.on('connection', function (socket) {
socket.on('chat message', function (msg) {
io.emit('chat message', msg);
});
});

http.listen(1337, function () {
console.log('escuchando en *:1337');
});

index.html


<!doctype html>
<html>
<head>
<title>Socket.IO chat</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font: 13px Helvetica, Arial;
}

form {
background: #000;
padding: 3px;
position: fixed;
bottom: 0;
width: 100%;
}

form input {
border: 0;
padding: 10px;
width: 90%;
margin-right: .5%;
}

form button {
width: 9%;
background: rgb(130, 224, 255);
border: none;
padding: 10px;
}

#messages {
list-style-type: none;
margin: 0;
padding: 0;
}

#messages li {
padding: 5px 10px;
}

#messages li:nth-child(odd) {
background: #eee;
}
</style>
</head>
<body>
<ul id="messages"></ul>
<form action="">
<input id="m" autocomplete="off" /><button>Send</button>
</form>
<script src="/socket.io/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script>
$(function () {
var socket = io();
$('form').submit(function (e) {
e.preventDefault(); // prevents page reloading
socket.emit('chat message', $('#m').val());
$('#m').val('');
return false;
});
socket.on('chat message', function (msg) {
$('#messages').append($('<li>').text(msg));
});
});
</script>
</body>
</html>

Añadimos log. En server.js:

var fs = require('fs');

fs.open('log.txt', 'w', function (err, file) {
    if (err) throw err;
    console.log('Creado!');
});
app.get('/', function (req, res) {
    res.sendFile(__dirname + '/index.html');
});

Después del emit:

  fs.appendFile('log.txt', msg+"\r\n", function (err) {
            if (err) throw err;
            console.log('Guardado!');
        });

Node

Por qué usar Node
https://www.toptal.com/nodejs/por-que-demonios-usaria-node-js-un-tutorial-caso-por-caso

Un tutorial en castellano:

https://www.nodebeginner.org/index-es.html

w3school nos quiere:

https://www.w3schools.com/nodejs/

Crear una api:

https://www.imaginaformacion.com/tutorial/aprende-nodejs-tutorial-de-primeros-pasos/

Tutorial completo:

https://www.guru99.com/node-js-tutorial.html

Oficial:
https://nodejs.org/api/synopsis.html

Enlaces React-Redux

Ejemplo de Crud en castellano (es traducción de otro artículo):

https://www.ma-no.org/es/programacion/javascript/ejemplo-completo-de-crud-con-redux-y-react

Guía definitiva que incluye muchas cosas y está muy bien explicada:

https://www.valentinog.com/blog/redux/

Ejemplo de Redux con un enlace diferente entre el store y las props:

Redux example

Una aplicación sencilla con react y redux:

https://dev.to/creativetim_official/how-to-use-redux-in-reactjs-with-real-life-examples-4gog

Diferentes maneras de hacer dispatch de acciones en react-redux:

https://www.pluralsight.com/guides/different-ways-to-dispatch-actions-with-redux

Middlewares en react:

https://www.metaltoad.com/blog/overview-redux-middleware-react-applications

Tutorial completo React+Redux:

https://medium.appbase.io/part1-getting-started-with-react-and-nextjs-4f28a6a0c38e

Tutorial completo redux:

https://developer.okta.com/blog/2019/03/18/beginners-guide-to-redux

Consejos para mejorar rendimiento:

https://itnext.io/3-small-tips-for-better-redux-performance-in-a-react-app-9cde549df6af

Tutorial:

https://www.creative-tim.com/blog/tutorial/reactjs-redux-tutorials/

React-redux + hooks:

https://thoughtbot.com/blog/using-redux-with-react-hooks

Tutorial Redux:

https://www.tutorialspoint.com/redux/index.htm

React tutorial con redux:

https://www.javatpoint.com/react-redux-example

Introducción bien explicada de react+redux:

https://medium.com/javascript-in-plain-english/the-only-introduction-to-redux-and-react-redux-youll-ever-need-8ce5da9e53c6

Redux crud example:

https://www.techandstartup.com/tutorials/react-redux-crud-app

Crear un CRUD en 5 minutos:

Fullstack CRUD:

https://medium.com/swlh/fullstack-crud-application-using-fastify-react-redux-mongodb-part-1-9e8df39c6fff