Feathers is a real-time, micro-service web framework for NodeJS that gives you control over your data via RESTful resources, sockets and flexible plug-ins.
install featherjs/cli
npm install @feathersjs/cli -g
Generate a feathers back-end API server
feathers generate app
Open file config and setup database
backend/config/default.json
create service
feathersjs generate service
set up model
// See https://sequelize.org/master/manual/model-basics.html
// for more of what you can do here.
const Sequelize = require('sequelize');
const DataTypes = Sequelize.DataTypes;
module.exports = function (app) {
const sequelizeClient = app.get('sequelizeClient');
const aboutUs = sequelizeClient.define('about_us', {
text: {
type: DataTypes.STRING,
allowNull: false
}
}, {
hooks: {
beforeCount(options) {
options.raw = true;
}
}
});
// eslint-disable-next-line no-unused-vars
aboutUs.associate = function (models) {
// Define associations here
// See https://sequelize.org/master/manual/assocs.html
};
return aboutUs;
};
get data form database
Top comments (0)