-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (31 loc) · 1021 Bytes
/
index.js
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
const customers = require ('./customers.json')
const products = require ('./products.json')
const{ initializeApp, applicationDefault, cert } =require('firebase-admin/app');
const { getFirestore, Timestamp, FieldValue } = require('firebase-admin/firestore');
const credentials = require('./credentials.json')
initializeApp({
credential: cert(credentials)
});
const db = getFirestore();
const express = require('express');
const { response } = require('express');
const app = express()
app.use(express.json())
app.listen(3000, () => {
console.log(`The API is listenin on port`)
})
// app.get('/', (request, response)=> {
// response.send('Hello World')
// })
// const prodRef = db.collection("products")
// prodRef.add(products[0])
// .then(doc => {
// console.log ('addded products', doc.id)
// })
// .catch(console.error)
// const custRef = db.collection ('customers')
// custRef.add (customers [2])
// .then(doc => {
// console.log ('added customers', doc.id)
// })
// .catch(console.error)