DEV Community

Ilyos Olimov
Ilyos Olimov

Posted on

Setting up new project

image

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

image

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 file
  • npx knex migrate:latest - this will create tables in your db
  • npx 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 with npx knex seed:run.

Top comments (3)

Collapse
 
mayaprest profile image
MayaPrest

I can create as many sites as I want with the template; what, the template does support cross-project reporting. black magic to control wife

Collapse
 
ilyosdev profile image
Ilyos Olimov

How can i unsee this comment. You ruined my life. 🀣🀣🀣🀣

Collapse
 
nodir_dev profile image
Nodirbek Sharipov

Great job πŸ‘