Skip to content

Commit

Permalink
Feat/remove user stories+update repo (freeCodeCamp#9)
Browse files Browse the repository at this point in the history
* feat: remove .gitconfig

* feat: remove hyperdev assets

* feat: add .gitignore

* feat: add sample.env

* feat: remove user stories from readme

* feat: update packages and add dotenv

* fix: update server.js

* fix: port variable

* fix: remove user stories from index + add favicon

* fix: replace tabs with spaces

* fix: css spacing + remove unused css
  • Loading branch information
moT01 authored Nov 23, 2020
1 parent 5f42c67 commit 4457ffe
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 217 deletions.
2 changes: 0 additions & 2 deletions .gitconfig

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
node_modules
59 changes: 0 additions & 59 deletions .hyperdev-assets

This file was deleted.

14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@

# API Project: File Metadata Microservice for freeCodeCamp
[![Run on Repl.it](https://repl.it/badge/github/freeCodeCamp/boilerplate-project-filemetadata)](https://repl.it/github/freeCodeCamp/boilerplate-project-filemetadata)
### User stories:
1. I can submit a form that includes a file upload.
2. The form file input field has the `name` attribute set to `upfile`.
3. When I submit something, I will receive the file `name`, `type`, and `size` in bytes within the JSON response.

### Usage :
* Go to the main page, and upload a file using the provided form.

### Hint:
* To handle the file uploading you should use the [multer](https://www.npmjs.com/package/multer) npm package.
# [File Metadata Microservice](https://www.freecodecamp.org/learn/apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice)
91 changes: 17 additions & 74 deletions package-lock.json

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

48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"name": "file_metadata",
"version": "0.0.1",
"description": "API project for freeCodeCamp",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^5.0.0-alpha.2",
"cors": "^2.8.1"
},
"engines": {
"node": "4.4.5"
},
"repository": {
"type": "git",
"url": "https://hyperdev.com/#!/project/welcome-project"
},
"keywords": [
"node",
"hyperdev",
"express"
],
"license": "MIT"
"name": "file_metadata",
"version": "0.0.1",
"description": "API project for freeCodeCamp",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"dotenv": "^8.2.0",
"express": "^4.16.4",
"cors": "^2.8.5"
},
"engines": {
"node": "12.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/freeCodeCamp/boilerplate-project-filemetadata"
},
"keywords": [
"node",
"express"
],
"license": "MIT"
}
34 changes: 11 additions & 23 deletions public/style.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
/****** Main Styling ******/

body {
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: #222;
background-color: #ECF0F1;
text-align: center;
font-family: 'Roboto', sans-serif;
font-size: 16px;
color: #222;
background-color: #ECF0F1;
text-align: center;
}

.container {
padding: 0;
margin-top: 40px;
padding: 0;
margin-top: 40px;
}

.footer {
margin-top: 60px;
}

ol {
list-style-position: inside;
}
ul {
list-style-type: none;
margin-top: 60px;
}

a {
color: #2574A9;
color: #2574A9;
}

input {
display: block;
position: relative;
margin: 10px auto;

}

input#button {
width: 230px;
}

.view {
position:relative;
margin: auto;
Expand All @@ -46,9 +40,3 @@ input#button {
width: 60%;
min-width: 400px;
}
/****** Logo Div Styling ******/

img {
margin: 20px auto 0 auto;
display: block;
}
1 change: 1 addition & 0 deletions sample.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PORT=3000
19 changes: 8 additions & 11 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
'use strict';

var express = require('express');
var cors = require('cors');

// require and use "multer"...
require('dotenv').config()

var app = express();

app.use(cors());
app.use('/public', express.static(process.cwd() + '/public'));

app.get('/', function (req, res) {
res.sendFile(process.cwd() + '/views/index.html');
});

app.get('/hello', function(req, res){
res.json({greetings: "Hello, API"});
res.sendFile(process.cwd() + '/views/index.html');
});

app.listen(process.env.PORT || 3000, function () {
console.log('Node.js listening ...');



const port = process.env.PORT || 3000;
app.listen(port, function () {
console.log('Your app is listening on port ' + port)
});
12 changes: 1 addition & 11 deletions views/index.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
<!DOCTYPE html>

<html>

<head>
<title>File Metadata</title>
<link rel="shortcut icon" href="https://cdn.hyperdev.com/us-east-1%3A52a203ff-088b-420f-81be-45bf559d01b1%2Ffavicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="https://cdn.freecodecamp.org/universal/favicons/favicon-32x32.png" type="image/x-icon"/>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
<link href="/public/style.css" rel="stylesheet" type="text/css">
</head>

<body>

<div class="container">
<h2>API Project: File Metadata Microservice</h2>
<h3>User Stories:</h3>
<ol>
<li>I can submit a form object that includes a file upload.</li>
<li>The from file input field has the "name" attribute set to "upfile". We rely on this in testing.</li>
<li>When I submit something, I will receive the file name, and size in bytes within the JSON response.</li>
</ol>

<h3>Usage:</h3>
<p>
Expand All @@ -39,6 +31,4 @@ <h4 id="output"></h4>
</p>
</div>
</body>


</html>

0 comments on commit 4457ffe

Please sign in to comment.