-
Notifications
You must be signed in to change notification settings - Fork 2
/
processNotes.txt
53 lines (31 loc) · 1.95 KB
/
processNotes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Process Notes
======================
After learning about web servers and application frameworks, I'm fascinated by just how many different ways
there are to make web servers in node.
Although there are quite a few ways to implement a web server, the following study will involve using
express but also a few other ways as well which I will add to this repository as time progresses in their own
respective branches.
If you are unfamiliar with Node, web servers, or NPM, check out my handy guide to server side web development
called Backend_Programming_Recipes for extra details.
Process Notes on Basic http web server
======================================
Very interesting process, but after attempting to do things in plain javascript, I can see why express is so
valueable and unobfuscated, especially when it comes to creating the server itself since express has an underlying
http server and you just dont have to do all of this.
How to setup a basic http web server
======================
For the basic web server, we'll use the basic example node provides on thier about page: https://nodejs.org/en/about/.
STEP 1: Create an application folder
STEP 2: Create a package.json folder with "npm init"
o Follow the details and fill them as you see fit.
STEP 3: Add an index.js file and insert basic html server example code in there.
STEP 4: Load modules
STEP 5: create mimeTypes object to list types of data we can server
STEP 6: Create server
o Most of the logic is taken care of in express but useful to know what is happening).
o When you run the server, you will get a 404 error because you dont have a html file yet.
STEP 7: Create an html file.
o At this point, when you run local host on the specified port 1337, you will see "This is a test".
resources
===============
https://www.freecodecamp.org/news/a-no-frills-guide-to-node-js-how-to-create-a-node-js-web-app-without-external-packages-a7b480b966d2/ -- outline