A progressive Node.js framework for building efficient and scalable server-side applications.
Fix it Up Backend Application developed with Typescript and using the framework of Nest. Persistence layer is implemented using TypeORM with MySQL Database. Object Mapping is based on AutoMapper TypeScript. The API has been deployed to IBM Cloud using Cloud Foundry, and uses database services from Amazon Web Services.
$ npm install
$ npm i -g @nestjs/cli
$ nest --version
$ npm i --save typeorm reflect-metadata mysql2
$ npm i --save @nestjs/typeorm @nestjs/cqrs
$ npm i --save typescript-result moment-timezone node-sql-reader
$ npm i @automapper/core @automapper/classes @automapper/nestjs @automapper/types
$ npm i --save-dev ts-node @types/node npm-run-all
Add typeorm command under scripts section in package.json
"scripts": {
...
"typeorm": "typeorm-ts-node-commonjs"
}
$ nest g resource customers
FIXITUP_DDD_NEST_MYSQL=mysql://{user}:{password}@{host}:{port}/{database}
FIXITUP_DDD_NEST_MYSQL=mysql://root:root@localhost:3306/fixitup-ddd-nest
ENVIRONMENT=local
ENVIRONMENT=prod
Note: Password must be URL encoded, %25 is the url encoding of %.
Client does not support authentication protocol requested by server; consider upgrading MySQL client. To fix it, run the following command changing the values with your credentials:
ALTER USER '{user}'@'{host}' IDENTIFIED WITH mysql_native_password BY '{password}'
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'
FLUSH PRIVILEGES;
$ npm run typeorm migration:create ./src/common/infrastructure/migrations/InitialSchema
$ npm run typeorm migration:create ./src/common/infrastructure/migrations/MasterData
$ npm run typeorm migration:create ./src/common/infrastructure/migrations/UserEmailUpdate
$ npm run typeorm migration:create ./src/common/infrastructure/migrations/UserEmailReupdate
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
This backend application has been deployed to IBM Cloud Foundry while using database services from Amazon Web Services.
https://cloud.ibm.com/login
https://github.com/cloudfoundry/cli/releases
$ npm run build
$ cd dist
$ cf push --no-start
- format: cf set-env {app-name} {var-name} {var-value}
$ cf set-env fixitup-ddd-nest ENVIRONMENT prod
$ cf set-env fixitup-ddd-nest FIXITUP_DDD_NEST_MYSQL mysql://{user}:{web service}:3306/fixitup-ddd-nest
$ cf push
Strings containing the following characters must be quoted:
:, {, }, [, ], ,, &, *, #, ?, |, -, <, >, =, !, %, @, \.
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Nest is MIT licensed.