-
Folder:
07-ORM-To-Sequelize/Unsolved
-
INSTRUCTIONS:
-
Create a new local MYSQL database called 'todolist', but don't create any tables.
-
Notice how there are no config or models folders?
-
In terminal, run
npm i
-
In terminal, run
npm i --save-dev sequelize-cli
-
In terminal, run
npm i -g npx
(You'll only have to do this once, ever, on this machine). More on npx: https://github.com/npm/npx https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b -
In terminal, type in the following commands (hit enter after each):
npx sequelize init:models
npx sequelize init:config
-
Step 6 should have created a config and a models folder for us. Navigate to the config folder, open
config.json
, and modify as per instructor's instructions to use .env file. -
Navigate to the models folder and create a new file called
todo.js
. Along with instructor, create a Todo model with columns for "text" (DataTypes.STRING), and "complete" (DataTypes.BOOLEAN). -
Navigate to the server.js file and require all of our models by requiring the models folder. Save this to a variable and name it "db".
-
Sync the models by running db.sequelize.sync() after we start the express server.
-
In your terminal, run
npm run watch
. Check MYSQL Workbench to see if a Todos table was created. If so, you were successful. If not, check your terminal for any errors. -
Now let's complete the
routes/api-routes.js
file to make the app work.
-
dahlia-lemonade-stand's Introduction
dahlia-lemonade-stand's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.