https://github.com/frf/node-server-ts-knex-jwt
Server node
https://github.com/frf/node-server-ts-knex-jwt
jwt mysql nodejs-server
Last synced: about 1 month ago
JSON representation
Server node
- Host: GitHub
- URL: https://github.com/frf/node-server-ts-knex-jwt
- Owner: frf
- Created: 2020-08-11T01:48:39.000Z (almost 6 years ago)
- Default Branch: develop
- Last Pushed: 2020-08-11T01:58:19.000Z (almost 6 years ago)
- Last Synced: 2025-09-21T23:37:23.525Z (9 months ago)
- Topics: jwt, mysql, nodejs-server
- Language: TypeScript
- Homepage:
- Size: 50.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Create server NodJS with typescript
## Init project
- yarn init -yp
## Add typescript in project
- yarn add typescript -D
## Init config auto TypeScript
- yarn tsc --init
## Configure ecma script to es2017 in file tsconfig.json line 7 (target)
## Add ts-node-dev wtach codification
- yarn add ts-node-dev -D
## Add script init in package.json
### --transpile-only don't check erros
### --ignore-watch node_modules don't check code in node_modules
### --respawn restart auto
"scripts": {
"start": "tsnd --transpile-only --ignore-watch node_modules --respawn src/server.ts"
}
## Add express microframework
- yarn add express
## Add types express
- yarn add @types/express -D
## Use JSON in express
app.use(express.json());
## GET params use request.params
app.post('/users/:id', (request, response) => {
console.log(request.params)
})
## Add knex and sqlite3
- yarn add knex sqlite3
## Create migrations with files em folder migrations and file config knexfile.ts overwrite commands
"knex:migrate": "knex --knexfile knexfile.ts migrate:latest",
"knex:migrate:rollback": "knex --knexfile knexfile.ts migrate:rollback"
## Add cors
- yarn add cors
## Add typescript cors
- yarn add @types/cors -D