Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webbestmaster/typescript-project-back-end
typescript-project-back-end
https://github.com/webbestmaster/typescript-project-back-end
Last synced: 28 days ago
JSON representation
typescript-project-back-end
- Host: GitHub
- URL: https://github.com/webbestmaster/typescript-project-back-end
- Owner: webbestmaster
- License: mit
- Created: 2021-10-28T20:09:40.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-28T20:50:02.000Z (over 3 years ago)
- Last Synced: 2024-11-14T22:34:30.661Z (3 months ago)
- Language: TypeScript
- Size: 167 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# \
## Installation
1. install nodejs (node v14.x+npm v6.x or node v16.x+npm v7.x) for your platform
2. go to project's directory
3. run `npm i` or `npm i --legacy-peer-deps`## Dev mode
1. make installation
2. go to project's directory
3. run `npm start`### NPM packages
npm-check-updates
```bash
$ [sudo] npm i -g npm-check-updates
$ ncu [-u]
// OR
$ npx npm-check-updates [-u]
```npm check updates
```bash
$ npm outdated
```depcheck
```bash
$ [sudo] npm i -g depcheck
$ depcheck
```### Nginx
Run
```
$ /usr/bin/nginx [-t] [-c ~/my-nginx.conf] [-g "daemon off;"]
````-t` - Don’t run, just test the configuration file. NGINX checks configuration for correct syntax and then try to open files referred in configuration.
`-c` - Specify which configuration file NGINX should use instead of the default.
`-g "daemon off;"` - do not exit from terminal```
$ sudo nginx -s stop
``````
$ sudo nginx -s reload
```### Docker
Build
```
$ docker build -t project-name:0.0.1 .
````-t` - add project name
Run
```
docker run [-d] -p "8080:9090" project-name:0.0.1
```
Use key `-d` to exit from terminal without stop server\image8080 - your local port to open app
9090 - server's port of app
Image list
```
$ docker image ls
```Running images
```
$ docker ps
```Stop image, get image name from `$ docker ps`
```
$ docker stop
```Remove image
```
$ docker image rm -f
```### Autotests
#### End-to-End test: jest + puppeteer
Required libraries:
1. jest
2. ts-jest
3. @types/jest4. puppeteer
5. @types/puppeteerRunning example:
```
$ jest ./test-e2e/ [--runInBand]
````--runInBand` - run tests sequentially
#### Unit test: jest + react-*
Required libraries:
1. jest
2. ts-jest
3. @types/jest4. @testing-library/react
5. @testing-library/jest-dom6*. use https://mswjs.io/ to make http request
7*. use https://github.com/testing-library/react-hooks-testing-library to test react hooks
Jest config `./jest.config.js`
```javascript
// eslint-disable-next-line unicorn/prefer-module
module.exports = {
globals: {
'ts-jest': {
tsconfig: './tsconfig.test.json',
},
},
modulePathIgnorePatterns: ['/tsc-check/'],
preset: 'ts-jest',
setupFilesAfterEnv: ['./test-unit/setup-jest.ts'],
testEnvironment: 'jsdom', // @testing-library/jest-dom
testTimeout: 10e3,
};
```Running example:
```
$ jest ./test-unit/ --coverage
```