Server configured by config/server.js or config/environments/**/*.json?

System Information
  • Strapi Version: v2.3.5
  • Operating System: Ubuntu 20.04.1 LTS
  • Database: MongoDB
  • Node Version: v14.8.0
  • NPM Version: v6.14.7
  • Yarn Version: v1.22.10

Hi. On https://strapi.io/documentation/3.0.0-beta.x/concepts/configurations.html#server I am reading about these config files. In my project I don’t have these files so I created the directories and files for some of them but then I noticed I already have a config/server.js and it does the same things as the config/envinronments/**/server.json.

  1. Do I have a different version then this documentations?
  2. What I really want to do is configure HTTP request logging. My setup involves Next.js with Server Side Rendering and Apollo GraphQL Client so the JWT token it receives should be configured in the Apollo GraphQL client and used for requests to StrAPI but currently I can’t verify that. I’m getting back an empty array and 200 from my strapi so I guess that its OK?

@Tom_Wieland

Can you check your version?
yarn strapi version

That documentation is for 3.0.0 (beta version). The latest version is 3.2.5 (stable)

it says 3.2.5

Then check the latest documentation.
https://strapi.io/documentation/v3.x/concepts/configurations.html

@sunnyson Got it. Some guides apparently link to that version in the menu from the current version.

I have another question: Can I convert .js files to .ts files in the strapi service directory? I have a lot of TypeScript code that I want to use and call from config/functions/cron.ts if possible. I’m migrating from TypeORM + TypeDI setup :slight_smile:

Currently TS is not supported by strapi. But you can compile your code from TS to plain JS and use it in cron.js.
Also there are some workarounds on github. But I would not recommend to use them.

1 Like