Repository navigation
01 Setup
JP Barbosa edited this page Apr 17, 2021
·
3 revisions
mkdir typescript-crud-api
cd typescript-crud-apigit init -b maincode .gitignorenode_modules/
build/
.envyarn init --yesyarn add typescriptcode tsconfig.json{
"compilerOptions": {
"lib": ["es5", "es6", "dom"],
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "./build",
"rootDir": "./src",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"resolveJsonModule": true
}
}mkdir ./src
code ./src/index.tsconsole.log('Application is up and running!');yarn add nodemon concurrentlycode package.json ...
"license": ...,
"scripts": {
"dev": "concurrently npm:start:*",
"start:build": "tsc -w",
"start:server": "nodemon ./build/index.js",
"start": "node ./build/index.js",
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
...yarn devWe should see "Application is up and running!" on terminal output (maybe a restart will be required for the first run).
git add .
git commit -m "Setup"