This is my 5th assignment for the Dynamic Web Development class in ITP, NYU. The course focuses on the fundamentals of building "full stack" web applications. Assignment for this week is to write server-side JavaScript to do CRUD operations on a database, controlled by an API, and client-side JavaScript triggered by user actions and making API requests, reading/writing to the database. I also should prepare my final project proposal.
This is the base backend code for my final project, that I will describe below. I didn't work on frontend part at all, because the main goal for this week was to understand databases. I also had a few issues that I can't solve for now, most importantly โ connecting to the MongoDB using mongoose.connect. I know what might be the reason of the problem, and I feel like I need to start building application from scratch avoiding some of the practices I used for this one.
I am also still struggling with pushing my local repository to github, this only got worse but and I also know what might be possible solution for that.
However, I finally got what Postman does, got more comfotable with npm and the whole backend structure of the document, and even a little bit more comfortable with the syntax in general. I also start to understand what's under the hood of the data and come to thinking of it as of structured and organized objects.
I am coming from Russia, and, in my opinion, there is the certain issue in my country about how some data or events are being presented in media. To be more precise, they are not presented at all or are being presented in a way that it's hard to say whether information is reliable or not.
Coronavirus is a dramatic example. My family is deeply concerned about the situation but they don't know whether the numbers of the cases in Russia are real, or authorities just manipulate the panic in order to prevent people from gathering together on any occasions including political ones.
However, I am not going to dedicate the project to the virus. I've been thinking a lot about specific ecological problem that is deeply silenced in the media. There are places in Russia that became, in fact, 'small Chernobyls' for they are being used as waste landfills or/and chemical wastes for years.
These places affect environment, water, animals, and people around them. Nevertheless, I don't think that I could just find some database with the numbers on diseases or eco-catastrophes that are caused by these huge waste dumps.
So, I started thinking how to create the dynamic data-viz' project with NO data.
I thought I could first have a brief research on the one spesific place and the damage it causes to the communities, nature, and climate, narrowing down to the limited number of implications. Then I could build a web application where people from the area could testify (= post to API) on these specific implications (case of disease, for instance). All the posts could be stored in database as json objects. Frontend part of the application is going to be the map and the images or/and words, generated out of the quotes from people's posts. More cases, the bigger these objects are (for now, I imagine something like text bubbles or word clouds). "Text bubbles" are placed on the map depending on the geolocation they came from.
Below is the documentation of my process working on the database and API this week. The goal was to build the backend part of the application where users can post to the database. There were some moments of happiness when things worked, and moments of desperation. This week I wasn't focusing on the Workbook provided for us in class. Instead, I spent more time on YouTube. Maybe that was a mistake, so I made a note to myself to complete the Workbook on databases as well. It would be smart also because the workflow in the Workbook is the most up-to-date as I realized eventually.
So, it was all going rather well:
mongoose.connect(
process.env.DB_CONNECTION,
{ useNewUrlParser: true }, () =>
console.log('connected to DB!')
);
Here is what I ended up with after googling and studying the example code that we had in class. The problem is not solved, however, even though now my document looks closer to the class example.
I will probably have to generate new SSH key because I just don't stop getting errors trying to push my local repository to the remote one from the command line.
And also, I didn't have any idea that the number of the uploads to GitHub is limited, so node_modules are not here. I wonder if it might be the reason why I couldn't push my repository from the terminal.