create-mern-omar 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/index.js +56 -25
- package/package.json +8 -9
- package/templates/.env.example +2 -0
- package/templates/.gitignore.template +2 -0
- package/templates/controllers/index.routes.js +10 -0
- package/templates/db/index.js +1 -0
- package/templates/models/User.js +26 -0
- package/templates/server.js +7 -8
- package/templates/package-lock.json +0 -1116
- package/templates/package.json +0 -19
- package/test-proj/db/index.js +0 -15
- package/test-proj/package-lock.json +0 -1116
- package/test-proj/package.json +0 -19
- package/test-proj/server.js +0 -55
package/test-proj/package.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "templates",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"main": "server.js",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
-
"start": "node server.js",
|
|
8
|
-
"dev": "nodemon server.js"
|
|
9
|
-
},
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"description": "",
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"dotenv": "^17.2.3",
|
|
15
|
-
"express": "^5.2.1",
|
|
16
|
-
"mongoose": "^9.0.2",
|
|
17
|
-
"morgan": "^1.10.1"
|
|
18
|
-
}
|
|
19
|
-
}
|
package/test-proj/server.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// imports
|
|
4
|
-
const express = require("express") //importing express package
|
|
5
|
-
const app = express() // creates a express application
|
|
6
|
-
require("dotenv").config() // allows us to use the .env variables
|
|
7
|
-
const morgan = require("morgan")
|
|
8
|
-
const conntectToDB = require('./db/index')
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// Middleware
|
|
16
|
-
app.use(express.static('public')); //all static files are in the public folder
|
|
17
|
-
app.use(express.json()); // this will allow us to parse through the JSON
|
|
18
|
-
app.use(morgan("dev")) // logs the requests as they are sent to our sever in the terminal
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
conntectToDB() // connect to database
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Routes go here
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
app.listen(3000,()=>{
|
|
52
|
-
console.log('App is running on port 3000')
|
|
53
|
-
}) // app will be waiting for requests on port 3000
|
|
54
|
-
|
|
55
|
-
|