Perishop is a web app that provides you with 300+ Shops.
Приложение Perishop создается с помощью среднего стека:
M: MongoDB (NoSQL / Non Relational database)
E: ExpressJs (Web application framework for building APIs)
A: Angular (Javascript MVC framework for front end web development)
N: NodeJs (Environment for running Javascript in the server side)
клиент-перископ/
Contains source code of the front end side :
- Components : client-perishop/src/app/components
- Services : client-perishop/src/app/services
- Modules : client-perishop/src/app
- Package.json (dependencies)
- Angular CLI generated files
Клиент/
This is the folder you need to try the app, please don't delete it.
It contains the project build after running :
> ng build
маршруты/
Содержит два файла:
? Shops.js :
Handling Shops end points.
? users.js :
Handling Users end points.
модели/
? Shops.js :
Holds the definition of Shop Model using Mongoose Schema, for querying the database and handling all CRUD operations that concerns shops records.
? users.js :
Holds the definition of User Model using Mongoose Schema, for querying the database and handling all CRUD operations that deals with users records.
конфигурация/
Holds an Object with database path to connect to using mongoose.
база данных/
Holds the database folder where all records go and mongoDB journaling is saved.
? app.js
Is the entry point to the app. It holds a set of imports among which : Express, Mongoose, BodyParser, Passport and other middleware.
Особенности Perishop:
Создайте папку проекта (например, Perishopapp) и CD в нее:
~$ cd ..../perishopApp
Клонировать репозиторий GitHub в папке проекта, работая:
~$ .../perishopApp // present working directory
git clone https://github.com/atidevs/perishop.git
Вам нужно установить MongoDB: сервер сообщества
https://www.mongodb.com/download-center?jmp=nav#community
Если вы находитесь в MacOS или Linux, пропустите этот шаг, если Windows скачать и установить GIT:
https://git-scm.com/downloads
После установки Mongodb и git откройте Git Bash и CD в:
~$ cd .../mongodb/bin (... : wherever path you installed mongodb in, usually C:/mongodb/bin)
Затем запустите эту команду:
~$ mongod --dbpath=".../perishopApp/perishop/database"
Откройте еще один терминал Git Bash:
~$ cd .../perishopApp/perishop (... : wherever the path to your perishopApp folder is)
А затем запустите эту команду:
~$ start
Откройте свой браузер и перейдите к:
localhost:3000
Поздравляю! Вы на домашней странице
Если вы хотите проверить записи в базе данных, выполните следующие действия:
Откройте командную строку (CMD) в качестве администратора в Windows или (терминал) в MacOS и Linux и запустите:
> mongo
После этого, если вы посмотрите на терминал Git Bash, где вы запускаете:
~$ mongod --dbpath=".../perishopApp/perishop/database"
Вы увидите где -то в конце (теперь откроется 2 соединения): первое соединение из самого приложения (когда вы запускаете ~ $ Start), а второе - это то, что мы только что запускаем: (> mongo).
Теперь вы можете запустить эти команды:
> show dbs // to show all available databases
> use perishop // to use the perishop database displayed among available dbs
> show collections // to show all collections inside perishop db
> db.users.find().pretty() // to list all signed up users and their information
> db.shops.find().pretty() // to list all shops and their information
Наслаждайтесь ✌