-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsteps.txt
72 lines (45 loc) · 1.04 KB
/
steps.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
(1) FIRST COMANDS TO CREATE EXPRESS APP:
express --view=pug --git inmueblesApp
cd inmueblesApp
npm install
npm start
http://localhost:3000/
(2) INSTALL NODEMON
npm install --save-dev nodemon
- Add in package.json:
"scripts": {
// The command to start the production server.
"start": "node ./bin/www",
// The command to start the dev server.
"dev": "nodemon ./bin/www"
}
npm run start //production
npm run dev //development
(3) INSTALL MONGOOSE & DOTENV
npm install dotenv mongoose
- Create .env:
MONGO_URL="mongodb://localhost:27017/propertiesDB"
- Add in www:
require('dotenv').config();
- Create config/db.js
- Add in www:
require('../config/db');
(4) ROUTES
- Create routes/api.js
- Create routes/api/properties.js
(5) MODELS (SCHEMA)
- Create models/property.model.js:
const propertySchema = new Schema({
floor: Number,
letter: String,
size: String,
num_rooms: Number,
rented: Boolean,
owner: String,
contact_email: String
});
(6) CRUD (routes/api/properties.js)
- GET
- POST
- PUT
- DELETE