Coder Social home page Coder Social logo

angular-uvniersal-training's Introduction

Angular Universal - techniques

This application is part of the Guide to the Angular Universal course available on newline.co

Prerequisites

To make this applicatin up and running you need to install the followings on your local machine:

To accomplish tasks during the workshop you need:

Apart of that you need to have a Free MongoDB Cloud account

MongoDB setup

Once you're done with installation of the prerequisites you need to set up MongoDB and adjust your project.

  1. Navigate to https://cloud.mongodb.com/user and sign in to your account

  2. Create a new clustiner (free shared is enough) in region that is closes to you: img

  3. When your cluster is ready, click the Connect button and follow the prompts in the Connect to Cluster panel to:

    1. Allow access from anywhere
    2. Create a MongoDB user: img
    3. In the Choose a connection method step, select Connect with the Mongo Shell. Follow directions for downloading, installing, and configuring the MongoDB Shell to run on your system.
    4. When you've configured the MongoDB Shell to run on your system, copy the supplied command-line instructions to a safe place.
  4. If you haven't done it yet - clone this repository

  5. Feed database with data with the following two commands:

mongoimport --uri mongodb+srv://<username>:<password>@<hostname>/<database_name> \
--collection products --file db/products.json
mongoimport --uri mongodb+srv://<username>:<password>@<hostname>/<database_name> \
--collection users --file db/users.json

ie:

mongoimport --uri mongodb+srv://username:[email protected]/myFirstDatabase \
--collection products --file db/products.json

Connect application with MongoDB

Edit the api.ts file to point to your MongoDB:

const dbUrl =
  'mongodb+srv://<username>:<password>@cluster0.1gerr.mongodb.net/myFirstDatabase';
const dbClient = MongoClient.connect(dbUrl, {
  useUnifiedTopology: true,
}).then((connection) => connection.db('myFirstDatabase'));

Final check

At the very end, try to install, build and start the application:

npm install
npm run build
npm start

After navigating to the localhost:8080 you should see an Angular Application up and running.

angular-uvniersal-training's People

Contributors

maciejtreder avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.