This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Connected to MongoDB... | |
| { genre: [ 'action, adventure, fantasy' ], | |
| releaseDate: 2019-02-23T18:50:55.357Z, | |
| _id: 5c71960ff3e891294bf8c218, | |
| name: 'Avengers', | |
| director: 'Joss Whedon', | |
| price: 10, | |
| __v: 0 } | |
| { genre: [ 'animation, action, adventure' ], | |
| releaseDate: 2019-02-23T18:50:55.357Z, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mongoose = require('mongoose'); | |
| mongoose.connect('mongodb://localhost/demo', { useNewUrlParser: true }) | |
| .then(() => console.log('Connected to MongoDB...')) | |
| .catch((err) => console.error('Could not connect to MongoDB...', err)); | |
| //create MovieSchema | |
| const movieSchema = new mongoose.Schema({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mongoose = require('mongoose'); | |
| mongoose.connect('mongodb://localhost/demo', {useNewUrlParser: true}) | |
| .then(()=> console.log('Connected to MongoDB...')) | |
| .catch((err) => console.error('Could not connect to MongoDB...', err)); | |
| //create MovieSchema | |
| const movieSchema = new mongoose.Schema({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mongoose = require('mongoose'); | |
| mongoose.connect('mongodb://localhost/demo', {useNewUrlParser: true}) | |
| .then(()=> console.log('Connected to MongoDB...')) | |
| .catch((err) => console.error('Could not connect to MongoDB...', err)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // User.swift | |
| // TableViewDemo | |
| // | |
| // Created by Bilguun Batbold on 22/2/19. | |
| // Copyright © 2019 ISEM. All rights reserved. | |
| // | |
| import Foundation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class ViewController: UIViewController { | |
| private let refreshControl = UIRefreshControl() | |
| //declare an outlet and connect to the tableview previously created | |
| @IBOutlet weak var usersTableView: UITableView! | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class ViewController: UIViewController { | |
| //declare an outlet and connect to the tableview previously created | |
| @IBOutlet weak var usersTableView: UITableView! | |
| private var userManager = UserManager() | |
| //initialize after self is available |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import UIKit | |
| public class UserDataSourceProvider: NSObject, UITableViewDelegate, UITableViewDataSource { | |
| //private var to hold the user manager | |
| private let userManager: UserManager | |
| //initialize the user manager |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| public struct User { | |
| let name: String | |
| let gender: String | |
| let email: String | |
| } | |
| public class UserManager { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // UserView.swift | |
| // TableViewDemo | |
| // | |
| // Created by Bilguun Batbold on 22/2/19. | |
| // Copyright © 2019 ISEM. All rights reserved. | |
| // | |
| import Foundation | |
| import UIKit |