MySqlRestServer
Zur Navigation springen
Zur Suche springen
Links[Bearbeiten]
Installation[Bearbeiten]
BASE=/home/ws/ts/mysql_rest_server
mkdir -p $BASE && cd $BASE
npm install express body-parser mysql2 dotenv
npm install typescript --save-dev
npm install @types/node @types/express @types/body-parser \
@types/mysql @types/dotenv --save-dev
npx tsc --init
mkdir -p source/models source/routes source/types
- tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "dist",
"strict": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
- package.json:
... "scripts": { "start": "tsc && node dist/app.js" } ...
- neue Datei .env
PORT=3306 DB_HOST="localhost" DB_USER="test" DB_PWD="TopSecret" DB_NAME="dbtest"