An Interest In:
Web News this Week
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
September 23, 2021 09:36 am GMT
Original Link: https://dev.to/ilyosdev/setting-up-new-project-57h8
Setting up new project
What do you know about solid, kiss and bunch of other things?
Fug them.
When you are writing any kind of code. Just write and see the result. You do not like it? Go change it.
Do not forget one thing, Rome is not built in one day or night
Let`s assume we all have nodejs installed. Create folder named like boilerplate and open that folder in your code editor.
initiate -
npm init -y
I like MVC, like a lot. So create bunch of folders such as controllers, models, services, middlewares, database(migrations, seeds), utils
Install necessary packages
npm install knex -g
npm install objection knex mysql --save
npm install express dotenv --save
Go grab the code from here
and continue.
First of all check the codebase, if you like it you are more than welcome to use it. If no, what the hell are you doing here then? Go leave my blog. Kidding .
Let me show you some things here:
npx knex migrate:make posts
- this will create migration filenpx knex migrate:latest
- this will create tables in your dbnpx knex migrate:rollback
- if you forgot something to add in your latest migration and you change it, try this then you are good to migrate again, without this your terminal spits right in your face.npx knex seed:make posts
- this creates file which you can populate with good old friend faker then you can insert it withnpx knex seed:run
.
Original Link: https://dev.to/ilyosdev/setting-up-new-project-57h8
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To