Source:  Twitter logo

I'm trying to start react-js app with node server. Structure of directory: MyTodo









file server.js:

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



app.listen(app.get('port'), function() {
	console.log('Server started: http://localhost:'+app.get('port')+'/');


var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

var config = module.exports = {
    context: __dirname,
    entry: {
        'App': './sources/App.jsx',

    output: {
        path: './bin/js',
        filename: '[name].js'

    plugins: [
        new ExtractTextPlugin('../css/[name].css')

	devServer: {
        contentBase: ".",
        host: "localhost",
        port: 3000
        loaders:[   //загрузчики
                test: /\.jsx?$/, // определяем тип файлов
                exclude: /(node_modules)/,
                loader: "babel-loader",
                    presets:["es2015", "react"]

    resolve: {
        extensions: ['', '.js', '.jsx']

In browser http://localhost:3000/ shows an error: GET http://localhost:3000/ 404 (Not Found)

You don't have any route for handling http://localhost:3000/

You have only static file handler which means this url would probably work http://localhost:3000/index.html

If you want to access your web at http://localhost:3000/ then add this

app.get('/', function(req, res){
    res.sendFile(__dirname+'/bin/index.html'); // change the path to your index.html
1 users liked answer #0dislike answer #01
Molda profile pic

Copyright © 2022 QueryThreads

All content on Query Threads is licensed under the Creative Commons Attribution-ShareAlike 3.0 license (CC BY-SA 3.0).