Skip to content

Commit f3e2c3e

Browse files
committed
Add boilerplates
1 parent cb54f8c commit f3e2c3e

File tree

9 files changed

+74
-63
lines changed

9 files changed

+74
-63
lines changed

.gitignore

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,2 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
8-
# Runtime data
9-
pids
10-
*.pid
11-
*.seed
12-
*.pid.lock
13-
14-
# Directory for instrumented libs generated by jscoverage/JSCover
15-
lib-cov
16-
17-
# Coverage directory used by tools like istanbul
18-
coverage
19-
20-
# nyc test coverage
21-
.nyc_output
22-
23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24-
.grunt
25-
26-
# Bower dependency directory (https://bower.io/)
27-
bower_components
28-
29-
# node-waf configuration
30-
.lock-wscript
31-
32-
# Compiled binary addons (https://nodejs.org/api/addons.html)
33-
build/Release
34-
35-
# Dependency directories
36-
node_modules/
37-
jspm_packages/
38-
39-
# TypeScript v1 declaration files
40-
typings/
41-
42-
# Optional npm cache directory
43-
.npm
44-
45-
# Optional eslint cache
46-
.eslintcache
47-
48-
# Optional REPL history
49-
.node_repl_history
50-
51-
# Output of 'npm pack'
52-
*.tgz
53-
54-
# Yarn Integrity file
55-
.yarn-integrity
56-
57-
# dotenv environment variables file
58-
.env
59-
60-
# next.js build output
61-
.next
1+
/node_modules
2+
package-lock.json
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
34
<head>
45
<meta charset="UTF-8">
56
<meta name="viewport" content="width=device-width, initial-scale=1.0">
67
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7-
<title>Clean-City</title>
8+
<link rel="stylesheet" href="main.css">
9+
<title>Clean City</title>
810
</head>
11+
912
<body>
10-
13+
Clean City
14+
<script src="./main.js"></script>
1115
</body>
16+
1217
</html>
File renamed without changes.
File renamed without changes.

controllers/userControllers.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// name the controllers in this format '<method of request><Name of the route>'
2+
exports.getTest = (req, res, next) => {
3+
res.send("Test");
4+
};

index.js

Whitespace-only changes.

package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "clean-city",
3+
"version": "1.0.0",
4+
"description": "Web Project For MAIT-Interns",
5+
"main": "server.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/DevelopHowTo/Clean-City.git"
12+
},
13+
"author": "",
14+
"license": "ISC",
15+
"bugs": {
16+
"url": "https://github.com/DevelopHowTo/Clean-City/issues"
17+
},
18+
"homepage": "https://github.com/DevelopHowTo/Clean-City#readme",
19+
"dependencies": {
20+
"body-parser": "^1.18.3",
21+
"express": "^4.16.4",
22+
"mongoose": "^5.5.1",
23+
"multer": "^1.4.1"
24+
}
25+
}

routes/userRoutes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const express = require("express");
2+
const router = express.Router();
3+
const userControllers = require("../controllers/userControllers");
4+
5+
// final route is /user/test
6+
router.get("/test", userControllers.getTest);
7+
8+
module.exports = router;

server.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Main server file
2+
const express = require("express");
3+
const path = require("path");
4+
const bodyParser = require("body-parser");
5+
6+
const app = express();
7+
8+
const userRoutes = require("./routes/userRoutes");
9+
10+
const PORT = process.env.PORT || 5000;
11+
12+
app.use(bodyParser.urlencoded({ extended: true }));
13+
app.use(bodyParser.json());
14+
15+
app.use(express.static(path.join(__dirname, "client")));
16+
17+
// Routes
18+
19+
// User route
20+
app.use("/user", userRoutes);
21+
22+
app.get("/", (req, res, next) => {
23+
res.sendFile(__dirname + "/client/index.html");
24+
});
25+
26+
app.listen(PORT, () => {
27+
console.log("Server has started");
28+
});

0 commit comments

Comments
 (0)