Я хочу загрузить сообщение журнала, когда пользователь вводит этот URL-адрес:
http: // локальный: 3000 / тест
но я получаю это сообщение об ошибке: Невозможно ПОЛУЧИТЬ / проверить
Это мой код:
import express from 'express';
import React from 'react';
import { renderToString } from 'react-dom/server';
import App from './client/App';
import Html from './client/Html';
import { ServerStyleSheet } from 'styled-components'; // <-- importing ServerStyleSheet
var http = require("http");
var https = require("https");
const port = 3000;
const server = express();
const request = require('request');
server.get('/test', (req, res) => res.send('Hello '));
server.get('/login', (req, res) => {
const sheet = new ServerStyleSheet();
const body = renderToString(sheet.collectStyles(<App />));
const styles = sheet.getStyleTags();
const title = 'Server side Rendering with Styled Components';
console.info("hello!");
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.info("body")
}
});
res.send(
Html({
body,
styles,
title
})
);
});
server.listen(port);
console.info(`Serving at http://localhost:${port}`);
что с этим не так? Что мне не хватает?
Моя версия компонентов:
"экспресс": "^ 4.14.0", "реагировать": "^ 16.2.0", "react-dom": "^ 16.2.0", "запрос": "^ 2.88.0",



![Безумие обратных вызовов в javascript [JS]](https://i.imgur.com/WsjO6zJb.png)


Я бы сделал это так:
// init variables
var express = require('express');
var app = express();
// routes to the specified path with the specified callback functions.
app.get('/test', function (req, res) {
res.send('Hello World!');
console.info('Hello');
});
app.listen(3000, function () {
console.info('Example app listening on port 3000!');
});
I want to load a log message when a user enters this url address:
Это все, что тебе нужно.
Получить дополнительную информацию здесь.
Это принципиально не отличается от того, что опубликовал OP.
Будь проще. С помощью этого кода он может шаг за шагом двигаться вперед.
Опубликуйте свой код реакции для index.js, для которого настроены маршруты.