react-admin Is a frontend Framework for building admin applications running in the browser on top of REST/GraphQL APIs, using ES6, React and Material Design. Previously named admin-on-rest. Open sourced and maintained by marmelab.
I'm trying to create and configure a Rest API (backend) using Nodejs/Express, I want to know how to configure the requests and the endpoints in my express API.
const express = require('express')
const app = express()
const bodyParser = require('body-parser');
const cors = require('cors');
const port = 80;
app.use(express.json());
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.get('/', (req, res) => {
return res.send('Received a GET HTTP method');
});
app.post('/', (req, res) => {
return res.send('Received a POST HTTP method');
});
app.put('/', (req, res) => {
return res.send('Received a PUT HTTP method');
});
app.delete('/', (req, res) => {
return res.send('Received a DELETE HTTP method');
});
app.listen(port, () =>
console.log(`Example app listening on port ${port}!`),
);