C
Join ServerC#
help
Communicating with a Minimal API built with .net 6 from a React app
Wwiz10/31/2022
Hello friends,
I am learning more about React and decided to play around with a tutorial, from there I wanted to add onto it by sending for example state changes from our TicTacToe game to a minimal API built in .net 6.
Currently, I am stuck with sending a MapPost to the minimal API, it seem to be working as intended in the network when I am testing the React app, but I am not getting anything on the minimal api side.
https://github.com/rogerertas/LearningReact
https://github.com/rogerertas/LearningMinimalApi
Thanks for reading!
I am learning more about React and decided to play around with a tutorial, from there I wanted to add onto it by sending for example state changes from our TicTacToe game to a minimal API built in .net 6.
Currently, I am stuck with sending a MapPost to the minimal API, it seem to be working as intended in the network when I am testing the React app, but I am not getting anything on the minimal api side.
https://github.com/rogerertas/LearningReact
https://github.com/rogerertas/LearningMinimalApi
Thanks for reading!
Ttebeco10/31/2022
ok so my first reflex is ...
Ttebeco10/31/2022
how are you sure it's done front end
Ttebeco10/31/2022
and not received backend
Ttebeco10/31/2022
I have a suspission
Ttebeco10/31/2022
but the point here is "missing context"
Ttebeco10/31/2022
how did you asserted "it works here but not there" ?
Ttebeco10/31/2022
implying you forgot to share the DevTool > network tabs
Ttebeco10/31/2022
which are likely to show an error on the prefligh / cors issue
Ttebeco10/31/2022
but thta's just a guess but it's hard to guess how you asserted what works 😄
Wwiz11/1/2022
Hello, thanks for answer and sorry for late response.
Currently struggling to get it up and running properly on my pc rather than laptop:
Currently struggling to get it up and running properly on my pc rather than laptop:
Ttebeco11/1/2022
$paste
Ttebeco11/1/2022

MMODiX11/1/2022
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
DDoktor911/1/2022
Oi, that's not the right image for the paste tag
Ttebeco11/1/2022
that's what happen when file are sent and some mobile just won't open file
Wwiz11/1/2022
hmm
Wwiz11/1/2022
I installed node js and npm
Wwiz11/1/2022
on my pc
Wwiz11/1/2022
and tried npm start in the root of LearningReact
Wwiz11/1/2022
to try and start it locally
Wwiz11/1/2022
but then I got a error: $ npm start
(node:20720) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use
Starting the development server...
my-app@0.1.0 start
react-scripts start
(node:20720) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use
node --trace-deprecation ...
to show where the warning was created)Starting the development server...
Wwiz11/1/2022
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (D:\dev\LearningReact\node_modules\webpack\lib\util\createHash.js:90:53)
at NormalModule._initBuildHash (D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:401:16)
at handleParseError (D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:449:10)
at D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:481:5
at D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:342:12
at D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at runSyncOrAsync (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
at iterateNormalLoaders (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array.<anonymous> (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (D:\dev\LearningReact\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at D:\dev\LearningReact\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
D:\dev\LearningReact\node_modules\react-scripts\scripts\start.js:19
throw err;
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (D:\dev\LearningReact\node_modules\webpack\lib\util\createHash.js:90:53)
at NormalModule._initBuildHash (D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:401:16)
at handleParseError (D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:449:10)
at D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:481:5
at D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:342:12
at D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at runSyncOrAsync (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
at iterateNormalLoaders (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array.<anonymous> (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (D:\dev\LearningReact\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at D:\dev\LearningReact\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
D:\dev\LearningReact\node_modules\react-scripts\scripts\start.js:19
throw err;
Wwiz11/1/2022
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (D:\dev\LearningReact\node_modules\webpack\lib\util\createHash.js:90:53)
at NormalModule._initBuildHash (D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:401:16)
at D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:433:10
at D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:308:13
at D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at D:\dev\LearningReact\node_modules\babel-loader\lib\index.js:51:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.12.0
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (D:\dev\LearningReact\node_modules\webpack\lib\util\createHash.js:90:53)
at NormalModule._initBuildHash (D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:401:16)
at D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:433:10
at D:\dev\LearningReact\node_modules\webpack\lib\NormalModule.js:308:13
at D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (D:\dev\LearningReact\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at D:\dev\LearningReact\node_modules\babel-loader\lib\index.js:51:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.12.0
Wwiz11/1/2022
Sorry for wall of text, I had idea to make it smaller in a .txt
Wwiz11/1/2022
is there a better "best pracc" way to share this kind of information?
Ttebeco11/1/2022
how did you created the app ?
Ttebeco11/1/2022
it seems to be using deprecated lib or standard
Ttebeco11/1/2022
a yeah you used CRA
Ttebeco11/1/2022
i think found a workaround for that last week
Ttebeco11/1/2022
i'll elaborate in 30min if you want
Ttebeco11/1/2022
i'm not on my pc
Ttebeco11/1/2022
my first advice is to drop cra for the template creation if you don't need it
Ttebeco11/1/2022
which mean delete all the repo
Ttebeco11/1/2022
and recreate
Ttebeco11/1/2022
npm create vite@latest my-app -- --template react-ts
Ttebeco11/1/2022
remember in npm
Ttebeco11/1/2022
no UPPER case
Ttebeco11/1/2022
no dot either
Ttebeco11/1/2022
full lower case and dash in name of app or package
Ttebeco11/1/2022
the reason for that drastic change is that CRA (Create React App) is slowly dying
Ttebeco11/1/2022
it's slow
Ttebeco11/1/2022
it's fuxking heavy
Ttebeco11/1/2022
there a lot of cve
Ttebeco11/1/2022
they never manage to get it up to date
Ttebeco11/1/2022
it rely on webpack
Ttebeco11/1/2022
which is also slow
Ttebeco11/1/2022
and it's using old way to "build/bundle"
Ttebeco11/1/2022
it rely on script that you don't have access to by default
Ttebeco11/1/2022
so it seems good until it's not
Ttebeco11/1/2022
and that's why
vite
replaced webpack based templateTtebeco11/1/2022
less shit/less bloat in template
Ttebeco11/1/2022
rely on esbuild to replace webpack
Ttebeco11/1/2022
less dependency => less cve / faster to install
Ttebeco11/1/2022
faster to start
Ttebeco11/1/2022
faster HMR
Ttebeco11/1/2022
The con' of cite template is if you're planning to deploy stuff
Ttebeco11/1/2022
because they have sort of script to help
Ttebeco11/1/2022
but let's be honnest they generally never fit anyway
Ttebeco11/1/2022
so that's my HIGHLTY RECOMENDED fix
Ttebeco11/1/2022
delete / recreate without CRA / use vite
Ttebeco11/1/2022
i bet it will fix your node error
Ttebeco11/1/2022
because CRA generate stuff that are outdated
Ttebeco11/1/2022
and node tell it to fuck off 🤣
Wwiz11/1/2022
I followed React tic tac toe tutorial from their page https://reactjs.org/tutorial/tutorial.html
Ttebeco11/1/2022
i'm not blaming you on that
Ttebeco11/1/2022
no worries
Wwiz11/1/2022
and then I wanted to do extra steps to integrate it with a server to try learn more in depth
Ttebeco11/1/2022

Ttebeco11/1/2022
that's the culprit
Ttebeco11/1/2022
because of all listed above
Ttebeco11/1/2022
Error: error:0308010C:digital envelope routines::unsupported
Ttebeco11/1/2022
this is before
create-react-app
pull shit 50% of the timeTtebeco11/1/2022
it will be fixed sooner or later
Ttebeco11/1/2022
and something else will break
Ttebeco11/1/2022
their template depends on HUNDREDS of library instead of like 3-4
Ttebeco11/1/2022
so yeah ... issues
Wwiz11/1/2022
I see
Wwiz11/1/2022
thanks for insight
Ttebeco11/1/2022
let me see
Ttebeco11/1/2022

Ttebeco11/1/2022
i't slow ....
Ttebeco11/1/2022

Wwiz11/1/2022
Ah, I need to do the same steps on the pc as I did on the laptop
Wwiz11/1/2022
to install the dependencies
Wwiz11/1/2022
I assume
Ttebeco11/1/2022
well
Ttebeco11/1/2022
wait
Ttebeco11/1/2022
let me finish with both tool
Wwiz11/1/2022
ok
Ttebeco11/1/2022
you'll see something
Ttebeco11/1/2022
let me do
npm create vite@latest my-app -- --template react-ts
firstWwiz11/1/2022
ok
Ttebeco11/1/2022
I'll just have to do it twice
Ttebeco11/1/2022
both
Ttebeco11/1/2022
in order to force the cache being populating
Ttebeco11/1/2022
so that I won't bench cache miss
Ttebeco11/1/2022

Ttebeco11/1/2022
so that's the thing I'm telling you to use instead of
npx create-react-app my-app
Ttebeco11/1/2022
