I am currently utilizing TypeORM for managing my database with NestJS framework on the server side and Vue.js on the client side.
Within the settings, I need to input a large text and ensure that line breaks (\n) are saved in the database.
Here's a snippet of my code:
Vue textarea
<b-form-textarea
style="white-space: pre-line"
v-model="projectShortDesc"
class="mt-2 description-input"></b-form-textarea>
Afterward, I send this data from
v-model="projectShortDesc"
to my server.
@Column({
type: 'varchar',
length: 150,
nullable: true
})
shortDescription: string;
To save it, I use the following method:
project.shortDescription = descFromVue;
await this.conn.getRepository(Project).save(project);
Could someone please advise me on how to store '\n' in the database when pressing enter
in the description field?
Many thanks for any assistance provided!