Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
console.log('Hello, node!');
const path = require('path')
console.log(path.resolve())

const moment = require('moment');

console.log(moment().format('dddd'));
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "w1-node-ecosystem",
"version": "1.0.0",
"description": "Welcome to JSCRIPT 400 - Server Side Development with JavaScript",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/asakleiman/w1-node-ecosystem.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/asakleiman/w1-node-ecosystem/issues"
},
"homepage": "https://github.com/asakleiman/w1-node-ecosystem#readme",
"dependencies": {
"moment": "^2.24.0"
}
}
25 changes: 13 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,63 +39,64 @@ $ npm -v
* **Question:** What is the difference between forking and cloning a repository as opposed to just cloning a repository?

* **Your Answer:**

cloning creates a local copy associated with the original repository; forking creates a branch of the orginal repositiry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful with the term "branching" as that applies to other actions related to git/GitHub. :)

---

- [ ] Run `npm init -y` from the command line

* **Question:** What does `npm init` do? How does the `-y` flag modify that command?

* **Your Answer:**

* **Your Answer:**
Automatically chooses the default options
---

- [ ] Take a look at the file that was generated by the previous command

* **Question:** What is the purpose of the following keys? "name", "scripts", "license"

* **Your Answer:**

Name is the project name. Scripts indicates where the scripts are. License is the distribution/use license
---

- [ ] Create a `.gitignore` file

* **Question:** What is the purpose of the `.gitignore` file? What is the significance of a "dot-file?"

* **Your Answer:**

it's a list of files to be overlooked by git when it creates and updates your repository. Always add the files containing your API keys to this.
---

- [ ] Create an `index.js` file with the following contents: `console.log('Hello, Node!')`

* **Question:** From the command line, how can you run this file?

* **Your Answer:**

node hello.js
---

- [ ] Run `npm test` from the command line

* **Question:** What happens and how is this related to what is in the `package.json` file?

* **Your Answer:**

Error: no test specificed. THe package.json file points to tests.
---

- [ ] Create a new "script" command called "start" that has the following value: `node index.js`

* **Question:** What will you enter on the command line to run that script?

* **Your Answer:**

run index.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would type npm start

---

- [ ] Change the name of your "start" script to "my-file"

* **Question:** The same pattern will not work to try and run this script. How can you successfully get this script to run?

* **Your Answer:**

By using run instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would type 'npm run my-file`

---

- [ ] Create a new file called `profile.js`. Inside the file, copy the following but replace `<your-name>` with your name:
Expand All @@ -110,7 +111,7 @@ $ npm -v
```

* **Question:** What gets logged? Why?

My name, because it's as an export
* **Your Answer:**

* **Question:** What is `module.exports` and what is its _type_ in JavaScript? What is `require` and what is its _type_ in JavaScript?
Expand All @@ -136,23 +137,23 @@ $ npm -v
* **Question:** What is `path` and where does it come from?

* **Your Answer:**

Part of the node package
---

- [ ] Install the [moment](https://www.npmjs.com/package/moment) package

* **Question:** What command can you run to install this package?

* **Your Answer:**

npm install moment --save
---

- [ ] On your own, use this package in the `index.js` file

* **Question:** Do you need to use a `./` to require the package? Why or why not?

* **Your Answer:**

no, because it is in node_modules
---

- [ ] Move your `profile.js` file into a `src/` folder. Update the path in your `index.js` file to ensure everything continues to work.
Expand Down
6 changes: 6 additions & 0 deletions src/profile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = 'Asa'



const profile = require('./src/profile.js')
console.log(profile)
1 change: 1 addition & 0 deletions w1-file-system
Submodule w1-file-system added at e983a4