I’m wondering if there’s an npm equivalent of rails generate model
to create a new object type? I’m building a React app that uses nodejs/express/mysql as a backend.
I remember it being extremely simple to create a new model (ie custom object type), or edit an existing one with a few commands. Is there anything like that with my setup?
(I know I’ll get in trouble for not providing code, so here’s my server.js file. As you can see I already have an object called “users”):
require('rootpath')();
const express = require('express');
const app = express();
const cors = require('cors');
const bodyParser = require('body-parser');
const errorHandler = require('_middleware/error-handler');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(cors());
// api routes
app.use('/users', require('./users/users.controller'));
// global error handler
app.use(errorHandler);
// start server
const port = process.env.NODE_ENV === 'production' ? (process.env.PORT || 80) : 4000;
app.listen(port, () => console.log('Server listening on port ' + port));
Let me know if there’s anything else I can provide to clarify the question 🙂