Skip to content

Instantly share code, notes, and snippets.

@gunaevart
Created November 2, 2024 10:56
Show Gist options
  • Save gunaevart/4f895370023720f3a340f7b826cedd14 to your computer and use it in GitHub Desktop.
Save gunaevart/4f895370023720f3a340f7b826cedd14 to your computer and use it in GitHub Desktop.
Развёртывание окружения fastiFy
{
"env": {
"es2021": true,
"node": true
},
"extends": [
"airbnb-base"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts"]
}
}
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"import/prefer-default-export": "off",
"import/extensions": "off",
"no-unused-vars": "warn",
"object-curly-spacing": ["error", "always"],
"no-useless-constructor": "warn",
"no-empty-function": "warn",
"class-methods-use-this": "off",
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/explicit-function-return-type": "error",
"max-len": "off",
"no-param-reassign": "off"
}
}
import { fastify } from 'fastify';
const server = fastify({
logger: true,
});
server.listen({ port: 3000 }, (err, address) => {
if (err) {
server.log.error(err);
process.exit(1);
}
});
{
"watch": ["src"],
"ext": "ts,json",
"exec": "ts-node ./src/index.ts"
}
Развёртывание окружения fastiFy
npm init -y
npm i fastify
npm i typescript --save-dev
npm i @types/node --save-dev
npx tsc --init
npm init @eslint/config
npm i ts-node nodemon --save-dev
{
"name": "ab-fastify-template",
"version": "1.0.0",
"description": "Fastify app template with TS, eslint, hot reload",
"main": "index.js",
"scripts": {
"dev:watch": "nodemon src/index.ts",
"build": "tsc",
"start": "node dist/index.js"
},
"keywords": [],
"author": "Ermolaev Ilya <[email protected]>",
"license": "MIT",
"dependencies": {
"fastify": "^4.11.0"
},
"devDependencies": {
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"eslint": "^8.31.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.26.0",
"nodemon": "^2.0.20",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
}
}
{
"compilerOptions": {
"target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "commonjs", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */
// "sourceMap": true, /* Create source map iles for emitted JavaScript files. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"strict": true, /* Enable all strict type-checking options. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment