I am using nodeJS with a response.
to set the reaction in my node that I used.
npm install
This is my index.html file
<html>
<head>
<script src="Script/script.jsx" type="text/babel"></script>
</head>
<body>
<div id="ExperimentForm"></div>
</body>
</html>
script.jsx
import React from 'react'; import ReactDOM from the "response";
var FormComponent = React.createClass({
render :function(){
return(<h2>Hello World</h2>);
}
})
ReactDOM.render(<FormComponent />, document.getElementById("ExperimentForm"));
I tried using
var express = require('express');
var app = express();
but it also did not work.
my app.js
var SwaggerExpress = require('swagger-express-mw');
const express = require('express');
const app = express();
const path = require('path');
var config = {
appRoot: __dirname
};
app.use(express.static(path.join(__dirname, 'views')));
app.get('/index', function (req, res) {
console.log("index page");
res.sendFile(path.join(__dirname + '/views/index.html'));
});
console.log(path.join(__dirname + '/views/index.html'));
SwaggerExpress.create(config, function (err, swaggerExpress) {
console.log("Starting server");
if (err) {
throw err;
}
swaggerExpress.register(app);
const port = 11011;
const server = app.listen(port, function () {
console.log('Server started @ %s!', port);
});
});
in the Google Developer Tool. I don't see any error, it seems to load index.html, but it doesn't display anything in the browser.
source
share