Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yjg30737/typescript-crud-example

Basic typescript CRUD example
https://github.com/yjg30737/typescript-crud-example

backend class-validator crud javascript mybatis mybatis-mapper nodejs restapi typescript

Last synced: 8 days ago
JSON representation

Basic typescript CRUD example

Awesome Lists containing this project

README

        

# typescript-crud-example
Basic CRUD server using TypeScript, class-validator, mybatis-mapper.

## Usage

1. git clone ~
2. import sql file in db directory
3. change the .env
4. npm i
5. npm start

※ if MODULE_NOT_FOUND happens then go back to 5(You will do it only one time after clone this)

## Note
### Why MODULE_NOT_FOUND error can be occured

package.json:
```json
...
"scripts": {
"start": "concurrently \"tsc -w\" \"nodemon dist/app\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
...
```
`concurrently \"tsc -w\" \"nodemon dist/app\"`

`concurrently` executes the command (almost) at the same time.

So `tsc -w` and `nodemon` dist/app will be executed simultaneously, it can be happen that

`nodemon dist/app` can be executed before `tsc -w` is executed.

### Test with Postman

BODY should be raw-json type.

```json
{
"name": "John",
"age": 44,
"job": "Freeloader"
}
```

For the sake of class-validation. If you don't send the request with raw-json, validation will be failed because all integers which is supposed to be integer send as string.