Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,619 members, 7,816,547 topics. Date: Friday, 03 May 2024 at 12:59 PM

My First Day With Node Js (I Made My Own Database System) - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / My First Day With Node Js (I Made My Own Database System) (896 Views)

Free PHP, Node js ,Mongo db, Angular And C# Proje Source Code With Documentation / Deep Knowledge Of Distributed Database System And Mapreduce / React + Node Js : Fullstack Web Development Training (2) (3) (4)

(1) (Reply) (Go Down)

My First Day With Node Js (I Made My Own Database System) by Fourpockets: 11:31am On Sep 28, 2022
I decided to try out node after getting bored from frontend and decided to see how backend works fully. So I went through w3schools and node is docs then I started playing with the server module to send APIs.
I then had a thought, when I end my server, all the JSON objects I send to my server to store in an array wouldn't save. I also couldn't find a built in module in node for local storage so I came up with my own custom database smiley .
It's not a database they you can use o, except you copy the code, it's just something I wanted to try to see if it's possible grin

It works like this:
The database is a JSON file with an empty array at first, I then read the file with the built-in file system module, parse the JSON file, when the post request comes in, I'll push it into the new js array, then I'll stringify it and write(overwrite) the existing empty array using the write file method from the file system module.

Here is the link to the code, I actually forgot to comment in the files undecided

https://github.com/osazuwairimoren/database-created-with-node-js-
Re: My First Day With Node Js (I Made My Own Database System) by chukwuebuka65(m): 12:23pm On Sep 28, 2022
Nice. JSON.parse() do throw errors and will crash a server if the string passed cannot be parsed to an object .Try to catch it.

1 Like

Re: My First Day With Node Js (I Made My Own Database System) by Fourpockets: 12:27pm On Sep 28, 2022
chukwuebuka65:
Nice. JSON.parse() do throw errors if the string passed cannot be parsed to an object and crash your server. Try to catch it.
No errors there, I've tested it. I linked the GitHub file, you can check yourself
Re: My First Day With Node Js (I Made My Own Database System) by chukwuebuka65(m): 12:31pm On Sep 28, 2022
Fourpockets:

No errors there, I've tested it. I linked the GitHub file, you can check yourself

You don’t understand what I mean. You should rap it with a try catch statement as a precaution incase accidentally a string that can not be parsed is passed to it. I don’t mean it throws an error now.
Re: My First Day With Node Js (I Made My Own Database System) by Nobody: 12:46pm On Sep 28, 2022
Only u Sabi wetin u the build.

grin

I saw ur code... Why didn't u use express to make your life easier....


The way u were commenting on one thread like that I thought u even had 2-3 years experience coding.... Who would have imagined this shiit.
Re: My First Day With Node Js (I Made My Own Database System) by chukwuebuka65(m): 1:01pm On Sep 28, 2022
GREATIGBOMAN:
Only u Sabi wetin u the build.

grin

I saw ur code... Why didn't u use express to make your life easier....


The way u were commenting on one thread like that I thought u even had 2-3 years experience coding.... Who would have imagined this shiit.

His first day with nodejs. Guy nawa for you oo. I no just understand your way.

4 Likes

Re: My First Day With Node Js (I Made My Own Database System) by Fourpockets: 1:29pm On Sep 28, 2022
GREATIGBOMAN:
Only u Sabi wetin u the build.

grin

I saw ur code... Why didn't u use express to make your life easier....


The way u were commenting on one thread like that I thought u even had 2-3 years experience coding.... Who would have imagined this shiit.
It was my first time using node is sir. I wanted to learn how it works, hence I didn't use any framework, tho from now on I'll be using express for creating servers cos from what I've seen, it's 100 times better than raw node
Re: My First Day With Node Js (I Made My Own Database System) by Fourpockets: 1:33pm On Sep 28, 2022
GREATIGBOMAN:
Only u Sabi wetin u the build.

grin

I saw ur code... Why didn't u use express to make your life easier....


The way u were commenting on one thread like that I thought u even had 2-3 years experience coding.... Who would have imagined this shiit.
... Also, you said you don't understand what I did, but also called it shit 2 paragraphs later undecided
Re: My First Day With Node Js (I Made My Own Database System) by Nobody: 1:35pm On Sep 28, 2022
chukwuebuka65:


His first day with nodejs. Guy nawa for you oo. I no just understand your way.

Hmm... Don't stress yourself
Re: My First Day With Node Js (I Made My Own Database System) by Nobody: 1:36pm On Sep 28, 2022
Fourpockets:

... Also, you said you don't understand what I did, but also called it shit 2 paragraphs later undecided

Yes bro
Re: My First Day With Node Js (I Made My Own Database System) by jansonn(m): 1:37pm On Sep 28, 2022
Hi bro
I'm working on a project that has some real life application that I would love to go life. I would like to contact you for the backend part. Non-pay actually
Re: My First Day With Node Js (I Made My Own Database System) by Fourpockets: 5:05pm On Sep 28, 2022
chukwuebuka65:


His first day with nodejs. Guy nawa for you oo. I no just understand your way.
I wish I understood that guy I swear
Re: My First Day With Node Js (I Made My Own Database System) by truthCoder: 6:13pm On Sep 28, 2022
Use Express

Get a Database connected

Serve via endpoints

Secure the bag
Re: My First Day With Node Js (I Made My Own Database System) by Fourpockets: 9:26pm On Sep 28, 2022
truthCoder:
Use Express

Get a Database connected

Serve via endpoints

Secure the bag
I know, next time I'm using express... I just wanted to know how node is works, that's why I didn't use any framework there
Re: My First Day With Node Js (I Made My Own Database System) by Fourpockets: 7:38pm On Sep 29, 2022
jansonn:
Hi bro
I'm working on a project that has some real life application that I would love to go life. I would like to contact you for the backend part. Non-pay actually
Just saw this.
Im still learning backend so I'm not the person for you
Re: My First Day With Node Js (I Made My Own Database System) by Qtrpst4: 1:44am On Sep 30, 2022
What is it about?
jansonn:
Hi bro
I'm working on a project that has some real life application that I would love to go life. I would like to contact you for the backend part. Non-pay actually
Re: My First Day With Node Js (I Made My Own Database System) by jansonn(m): 6:47am On Sep 30, 2022
Qtrpst4:
What is it about?
it's a medical recording keeping system for patients. I could contact you you if you want details. However, I really don't have money to pay. Maybe we could just be co-founders cheesy cheesy
Re: My First Day With Node Js (I Made My Own Database System) by Qtrpst4: 12:45pm On Sep 30, 2022
OK, I will want to know about it. Though am not to strong with back end but am trying my hands on it
Let's talk
jansonn:
it's a medical recording keeping system for patients. I could contact you you if you want details. However, I really don't have money to pay. Maybe we could just be co-founders cheesy cheesy
Re: My First Day With Node Js (I Made My Own Database System) by jansonn(m): 3:08pm On Oct 01, 2022
Qtrpst4:
OK, I will want to know about it. Though am not to strong with back end but am trying my hands on it
Let's talk
I've sent you a mail
Re: My First Day With Node Js (I Made My Own Database System) by Qtrpst4: 3:49pm On Oct 01, 2022
I didn't receive it
jansonn:

I've sent you a mail

(1) (Reply)

C Sharp Is So Interesting / Pls Can Somebody Help Me / Web Application: Update Mode Does Not Retain View State. Pls Help!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 33
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.