Lynxgsm / clean-express-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A simple Express boilerplate

Built in

  • Typescript
  • Express
  • Typeorm (with Mysql)
  • Jest
  • Prettier
  • Eslint
  • Dependency Injection using InversifyJS

Get started

Step 1: Clone the project

You can do using git command:

git clone https://github.com/heryTz/clean-express-app

Step 2: Setup server

  • Define your environment variable in .env (see env.example)
  • Define your database config in ormconfig.js (see ormconfig.example.js)

Step 3: Run server

npm run dev

Branch

You can check these branches for the different base codes that exist

  • master: The basic architecture
  • foo-service: A example how you can implement a service

Troubleshooting

1. Using Typescript entities with typeorm cli.

It doesn't work if you directly use the cli typeorm. Use the npm script typeorm that already exists in the package.json.

Then you may run the command like this:

npm run typeorm migration:run

If you need to pass parameter with dash to npm script, you will need to add them after --. For example, if you need to generate, the command is like this:

npm run typeorm migration:generate -- -n migrationNameHere

Please refer this documentation for more information (https://typeorm.io/#/using-cli/if-entities-files-are-in-typescript).

About


Languages

Language:TypeScript 91.2%Language:JavaScript 7.1%Language:Shell 1.7%