DEV Community

Ilyos Olimov
Ilyos Olimov

Posted on

4 2

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.

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

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 πŸ‘

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❀️