Console still has an error:
Access to fetch at ‘http://localhost:3000/forest’ from origin ‘https://app.forestadmin.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
thank you for you help, I really appreciate that. However, I am still a bit confused.
In you interactive tutorial by setting up the backend, you are talking about connection.
Check this screenshot:
You are talking about "Connection that should be initialised"? What do you mean with that, please? Initialised can be each singe model, but not connection. Or I am wrong?
Connection is described here:
But according to that, connection can’t be initialised.
Secondly, I also watched you video here: Express integration for Forest Admin
Could you please briefly tell me, what is done in 1min 12s of that video on that page? What exactly are you importing from the folder models?
Yes, I agree the wording is bad. I’ve already transmit your feedback to our team. So the connection is a sequelize instance with a working connection to a database and with all models (Creating an instance) you want to work with.
The connection you want to provide to ForestAdmin should be initialised with the models you want to work with. So you create a connection to your DB then you define models for this connection.
It the file that we use to handle connections and to define/import/require models (when you use the forest-cli those are automatically generated by making CRUD (introspection) on your DB).
I think your file …/utils/db is meant to do the same in your case. Can your share the content of this file ?
I’ll give you a concret example I use myself.
1. A file that describe connections and load all models in the folder /models
models/index.js Here we define connections to the DB using environment variable DATABASE_URL_DEFAULT
thank you for you post. Unfortunately, I am new in sequelize and so it took me a couple of hours to figure out, that you simply use sequelize-cli that build that file structure for you. However, that is not the only way how to work with sequelize but probably the only way how to apply forest admin on sequelize.
You can recommend this video, that help me
So, I made some progress and forest admin somehow sees my models, but I am getting warning right now, that I am unable to authenticate. It seems like something should run on localhost:3310?
Everyone would assume, it must work right now, which is absolutely misleading. Nowhere is described that you also need to install forest backend that is accessible on the port 3310. This all is served by your great forest-cli, that creates server.js and necessary middlewares. It will never work without that, but it is not described anywhere.
As already mentioned in my previous post, you also require a specific modules structure that is provided by sequelize-cli, this can be also prepared by your forest-cli. That is such a pity you do not mention that anywhere in the installation wizard.
Nothing is even written about that in your documentation:
If you follow step-by-step this tutorial from scratch, you won’t definitely install forest admin, because the whole server part on port 3310 is missing.
I hope it does not sound just as critic, I just wanted to help you to stop loosing your customers.
I guess I found the issue. In the step where people are allowed to choose the port, e.g. http://localhost:3000, it seems that only 3310 works anyway and your server is trying to approach this endpoint.
Sorry that you encounter some issue during the onboarding. We try to provide the smoothest experience for our users. So any constructed critics are welcomed !
I’ll try to be as clear as possible. There is 2 main way to integrate Forest Admin either by choosing a data source (eg. Postgress, MySQL, MongoDB …) or what we call InApp (eg. Express/Sequelize, Express/Mongoose).
When choosing a data sources, the necessary files (also the sequelize one) are automatically generated.
When choosing the InApp you’re the one in charge to generate those files since you are integrating Forest Admin into an existing application. (but clearly we need to have a more mature documentation)
As you said, I’m sure we can still improve the experience by smoothing those first steps.
I’ll forward your feedback right now to our team !
That’s not the intended behaviour ! I’ll try to reproduce on my side !
I tried to reproduce the issue, but I’m not able to reproduce it.
I’m wondering, how you ended up with the wrong endpoint. Can you share your project name ?
Also, why did you choose the Express / Sequelize datasource ? (It’s important that we understand your need on this one and if the onboarding mislead you to choose this one against another simpler solution → project generated with the forest-cli when using postgres as a datasource)
As you see, there is this congratulation page, but I can’t go further or click on anything.
Project is called: qms-test
When I just leave this page, go to my administration and enter the project again, everything is running properly already. But now, the server port does not make any difference. It works on both 3000 and 3310.
to your second question why I decided for Express / Sequelize. I didn’t know that project based on sequelize using forest-cli will be created. And so I created Sequelize project on my own and then choosed this option.