Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/yjg30737/typescript-crud-example
- Owner: yjg30737
- License: mit
- Created: 2022-10-03T01:23:16.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-03T01:26:14.000Z (about 2 years ago)
- Last Synced: 2023-03-04T22:18:06.142Z (over 1 year ago)
- Topics: backend, class-validator, crud, javascript, mybatis, mybatis-mapper, nodejs, restapi, typescript
- Language: TypeScript
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 occuredpackage.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.