Communicating with a Minimal API built with .net 6 from a React app
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!
GitHub
GitHub - rogerertas/LearningReact
Contribute to rogerertas/LearningReact development by creating an account on GitHub.
GitHub
GitHub - rogerertas/LearningMinimalApi
Contribute to rogerertas/LearningMinimalApi development by creating an account on GitHub.
71 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Hello, thanks for answer and sorry for late response.
Currently struggling to get it up and running properly on my pc rather than laptop:
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
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!
Oi, that's not the right image for the paste tag
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
hmm
I installed node js and npm
on my pc
and tried npm start in the root of LearningReact
to try and start it locally
but then I got a error: $ npm start
[email protected] 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...
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;
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
Sorry for wall of text, I had idea to make it smaller in a .txt
is there a better "best pracc" way to share this kind of information?Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I followed React tic tac toe tutorial from their page https://reactjs.org/tutorial/tutorial.html
Tutorial: Intro to React – React
A JavaScript library for building user interfaces
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
and then I wanted to do extra steps to integrate it with a server to try learn more in depth
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I see
thanks for insight
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Ah, I need to do the same steps on the pc as I did on the laptop
to install the dependencies
I assume
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ok
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ok
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
reading through it
Sorry my son was litterary climbing on my head
ok, he is finally sleeping.
so i should do a npm create vite @my-app -- -- template react-ts
it seems to be a lot more efficient
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Welcome back
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ok
but I need to make a new "project" now?
with vite
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
the only thing made is the mapPost attempt
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
from react to minimal api
I am confident with git
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
yes
but basically I need a clean state
I will do it, moment
ok, it is now re made into a vite project
Now I need to add the code back, I ended up copying everything to a different folder and deleting everything
then doing $ npm create vite @latest my-app -- --template react-ts
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
My son had fever today so was with him whole day, in couple hours he will sleep tho then I will make index.js and grab the code from where i copied it too back into the repo.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Ah ,alright
use ts 😎
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ok, so i will keep the template as is commited now with ts
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
that would be nice
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
my goal with this learning is to send requests from a react app to minimal app and then build a message queue at a later stage
the tic tac toe was just something I found on the node js page and decided to follow since it seemed pretty easy to follow and maybe grasp some concepts
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I understood more about states and the dom from it
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
eliminates the need for PropTypes, if oyu see those in the wild
just use typed prop interfaces instead
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I see
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
https://react-typescript-cheatsheet.netlify.app/docs/basic/setup this is good too if you have trouble finding certain types
for events etc
Well, I say that I see but I don't have the exp with these tools yet to fully understand :)
but it is good to learn best pracc from beginning
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
if you come from c#, just use ts from the jump :-]
you'll avoid 99% of js weirdness
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
as const
is important to learn as wellUnknown User•3y ago
Message Not Public
Sign In & Join Server To View
if you want readonly stuff
or derived types
but yeah
var
is not the same as it is in c#
it makes a global 🤢thanks for a lot of easily digestable info, appreciate it
and yes i come from c#.net
mostly been in the cloud lately, google cloud azure api management etc
right now I am about to try converting the js code to ts
from the tic tac toe game
still with my son in this second
ok, thanks will keep in mind. it is a c# habit to just use var everywhere and let the assigned value set type.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ok
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
in c# const is readonly
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ok
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ok yeah, will start looking into moving in the game soon
bed time for my son
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
🙏
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
just complaining and doesn't want to sleep
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View