Skip to content

The purpose of this package is to build an express app with a react frontend based off of sequelize models.

Notifications You must be signed in to change notification settings

stuff-first/code-first

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code First

The purpose of this package is to generate boilerplates for different tech stacks, with the very first tech stack iteration being mysql through sequelize, node, express, react. Eventually we will also build upon this and make it so it can build frontend skeletons using material-ui package automatically based off sequelize models and extra config info.

Getting Started

To use cli:

either use npx e.g.:

npx code-first init

or

install and use via commandline:

npm i -g code-first
code-first init

Useage of CLI:

  • init - should be run on empty repository/folder, creates all the boilerplate files for project.
  • build - run after creating sequelize models

Example project:

  • Start by running bash commands:
mkdir my-project
cd my-project
git init
npx code-first init
npm run sequelize -- model:create --name User --attributes name:string,state:boolean,birth:date,card:integer,role:enum:'{Admin,Guest}'
npm run sequelize -- model:create --name Person --attributes name:string,state:boolean,birth:date,card:integer,role:enum:'{Admin,Guest}'
  • copy into person.js's .associate method
Person.belongsTo(models.User);
  • copy into user.js's .associate method
User.hasMany(models.Person, {
    onCascade: "delete"
});
  • then run the bash command:
npx code-first build

About

The purpose of this package is to build an express app with a react frontend based off of sequelize models.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published