Week 5 : Right Place, Wrong Time...
- Alwin Joshy Joseph
- Mar 11, 2021
- 4 min read
Updated: Mar 13, 2021
Class 13 [Noir Elements need to added ( noir jazz link to accompany journal writing and assist the mood) https://youtu.be/HbbxAHwPPE8?t=40] It was Sunday, the class stared I was very busy. I did not get much time to concentrate at the class. but I was always there, that day we learned about loading the text data from a separate file. we used the file system to first open a file and then read the file into a variable. Then take the red text and send the html file to the the browser with the header defining the type of the data. Note put res.end() at the end of the transmitted data so that the browser knows when to stop reading. He tried to show us how the have multiple pages and data bases off of different URL requests. we tried to first classify the request as GET request then if it is we send an html form back to the browser with a name field a password field and a submit button. once the submit button is pressed the browser send the form data to the server which can be captured and analyzed. we tried to get the data from the request neatly but it was a lot of unnecessary and time consuming process. so he said to avoid all the hustle we can instead use a popular and free node package known as express. which is soo popular such that. its present behind every rest API calls. for the coming class he said us to have a look at MongoDB and make an account for it. also the coming class we will be implementing expo package to manage the redirection and url and data extraction. Class 14 It was a fine Thursday, I don't know what's going on, none of us do. Travelled quiet some time, but was mostly sleeping on the way, standing. I reached at the uni. I was a few minutes early I went in and setup my stuff. went out to get some tea. I reached back and the tutor already began the class. he said the main thing we will be focusing in the session is getting the back end running and also we will be looking into other miscellaneous stuff that's necessary to enable this. so first off we installed a package called dotenv which is a package that enables us to read .env files. .env files is a file format that is used standard file to hold all the environment variables and values of the server. after installing the package, Anikith asked what would we do if we need different .env files to be red from for example dev or prod. for that we passed in weather if its dev or prod as arguments and then later read it and initialized the appropriate .env file.

then we moved on to implementing Mongoose DB. we installed the mongodb package and started by making an account in mongodb website. once that's done we copied authentication details which will be send to the server to establish the connection.

then we were introduced to a few functions that enables things like establishing connection setting data and getting data. then main thing that we were taught while using MongooseDB is that we need to use data format called as Schemas. for example like the one I used shown below.

then then we managed to upload a sample data into the collection called "testcollection" then I retrieved the data from the collection. by sending the age data for it to compare and return the matching data.

the he said the next class we will be implementing API in the back end which can be called from the Unity3D C#.
Class 15 It was a busy Saturday morning. I woke up and started working in a task I was given from the uni. I made a compound state-machine system for a help work and moved on to working on the client project at my job, then the class began and I hoped in. The class was about about the architecture that we implement to get a proper backend system running. What we do for that is we make a 2 part system comprising of Database and Server. We started by making modifications to the backend script that previously connected and directly posted date to the Mongoose server. Instead we made it such that we connect to the server but waits for a post request in the server and then take the posted data and send it to the Database for storage. the heard of the process was were we took the posted binary data and filed it into a buffer array, then parsed the array to string and then parsed the string into json object.

We also installed a free program called postman to make post requests to the server which is running in the localhost:3000.

Then we went on working on Unity3D to get to make the web-request system to make a post request from within unity to the localhost so that the data can be taken and send to the server.

it was a bit of a struggle to get it working but I eventually got it working. I later sat and managed to make a parser for anonymous classes that can be send to the API server.
Recent Posts
See AllClass 39 : We join in the class on Sunday. There's is nothing much to teach from our tutors side. all of us guys are doing our curricular...
Class 36 : It was a Sunday. a busy morning. I showed up for the class, the tutor asked us let him know if we need any support with the...
Comments