Code Monkey home page Code Monkey logo

fastify-typescript-starter's People

Contributors

garytube avatar yonathan06 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fastify-typescript-starter's Issues

Newbie question - how to build and run the server

When using your template how do we build and run the fastify app?

In the template provided by fastify-cli the package.json looks like this..

"scripts": {
    "test": "npm run build:ts && tsc -p test/tsconfig.json && tap --ts test/**/*.test.ts",
    "start": "npm run build:ts && fastify start -l info dist/app.js",
    "build:ts": "tsc",
    "dev": "tsc && concurrently -k -p \"[{name}]\" -n \"TypeScript,App\" -c \"yellow.bold,cyan.bold\" \"tsc -w\" \"fastify start --ignore-watch=.ts$ -w -l info -P dist/app.js\""
  },

In your it looks like this

   "lint": "eslint .",
    "lint:fix": "eslint . --fix",
    "check:types": "tsc --noEmit",
    "build": "esbuild-node-tsc",
    "build:docker:prod": "docker build . -t my-fastify-app --build-arg APP_ENV=production",
    "start": "node build",
    "dev": "nodemon | pino-pretty --colorize",
    "pretest": "npm run build",
    "test": "NODE_ENV=test tap",
    "test:watch": "NODE_ENV=test tap -w"

Thanks.

app crashing

I am getting the below error when running it on my windows development machine. I have checked it with nodejs 18, 14, and 10. each version has the same issue. can anyone please help?

C:\projects\fastify-app\my-server>npm run dev

[email protected] dev
nodemon | pino-pretty --colorize

[nodemon] 2.0.19
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): src*** tsconfig.json .env
[nodemon] watching extensions: ts
[nodemon] starting npm run build && npm start

[email protected] build
esbuild find src \( -name '*.ts' \) --platform=node --outdir=build --resolve-extensions=.js

X [ERROR] Invalid build flag: "-name"

1 error
node:child_process:910
throw err;
^

Error: Command failed: C:\projects\fastify-app\my-server\node_modules\esbuild-windows-64\esbuild.exe find src \( -name '*.ts' \) --platform=node --outdir=build --resolve-extensions=.js
at checkExecSyncError (node:child_process:871:11)
at Object.execFileSync (node:child_process:907:15)
at Object. (C:\projects\fastify-app\my-server\node_modules\esbuild\bin\esbuild:177:28)
at Module._compile (node:internal/modules/cjs/loader:1119:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
at Module.load (node:internal/modules/cjs/loader:997:32)
at Module._load (node:internal/modules/cjs/loader:838:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:18:47 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 12212,
stdout: null,
stderr: null
}

Node.js v18.8.0
[nodemon] app crashed - waiting for file changes before starting...

Error Running Tests

Having run pnpm install followed by pnpm build, I can get the server running locally and it works as expected.

However, running pnpm test or pnpm test:watch fails with the following errors:

Test Files  no tests
   Tests  no tests
   Start at  12:44:06
   Duration  234ms (transform 39ms, setup 0ms, collect 0ms, tests 0ms)

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Vitest caught 2 unhandled errors during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: Failed to load url tinyspy (resolved id: tinyspy). Does the file exist?
 ❯ loadAndTransform node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-52909643.js:55015:21
 ❯ ViteNodeServer._transformRequest node_modules/.pnpm/[email protected]/node_modules/vitest/dist/chunk-vite-node-externalize.b9495318.js:7059:16
 ❯ ViteNodeServer._fetchModule node_modules/.pnpm/[email protected]/node_modules/vitest/dist/chunk-vite-node-externalize.b9495318.js:7038:17
 ❯ MessagePort.<anonymous> node_modules/.pnpm/[email protected]/node_modules/vitest/dist/chunk-vite-node-source-map.b4ea5792.js:419:18


⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: Failed to load url tinyspy (resolved id: tinyspy). Does the file exist?
 ❯ loadAndTransform node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-52909643.js:55015:21
 ❯ ViteNodeServer._transformRequest node_modules/.pnpm/[email protected]/node_modules/vitest/dist/chunk-vite-node-externalize.b9495318.js:7059:16
 ❯ ViteNodeServer._fetchModule node_modules/.pnpm/[email protected]/node_modules/vitest/dist/chunk-vite-node-externalize.b9495318.js:7038:17
 ❯ MessagePort.<anonymous> node_modules/.pnpm/[email protected]/node_modules/vitest/dist/chunk-vite-node-source-map.b4ea5792.js:419:18

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  Tests failed. Watching for file changes...
       press h to show help, press q to quit

Any idea as to what I am missing here to get the tests passing? I am really impressed by this boilerplate - thank you for providing!

Typo in nodemon.json

Hi there, I notice your nodemon.json as this..

{
  "watch": ["src", "tsconfig.json", "development.env"],
  "ext": "ts",
  "ignore": ["src/**/*.spec.ts"],
  "exec": "npm run build && npm start",
  "env": {
    "NODE_DEBUG": 9229,
    "NODE_ENV": "development"
  }
}

Shouldnt it refer to .env.development instead of development.env?

Build/production doesn't work

The current repo doesn't work for production. The esbuild process doesn't seem to work. Installing the repo fresh:

> node build

node:internal/errors:465
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/jmill/projects/misc/fastify-typescript-starter/build/server' imported from /Users/jmill/projects/misc/fastify-typescript-starter/build/index.js
    at new NodeError (node:internal/errors:372:5)
    at finalizeResolution (node:internal/modules/esm/resolve:437:11)
    at moduleResolve (node:internal/modules/esm/resolve:1009:10)
    at defaultResolve (node:internal/modules/esm/resolve:1218:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}
 ELIFECYCLE  Command failed with exit code 1.

Need instructions on how to start in the docker

To start the process in docker, you must first install pnpm locally, then install packages through it (to create pnpm-lock.yaml) and only after that you can start docker (and it is also important not to forget to create an .env.something file and pass this something as an APP_ENV environment variable)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.