Node.js, Express, Angular 5, Swagger, Socket.io
This project was generated with Angular CLI version 1.2.0.
-
Install Node.js and npm from here. Ensure you can run
nodeandnpmfrom a terminal. -
Run
npm installinside the project directory,spotifycollab, to install missing dependencies. -
Run
npm installinside thespotifycollab/rest-apidirectory to install missing dependencies for the Swagger project. -
Run the following three commands:
npm install -g nodemonnpm install -g swaggernpm install -g angular-cli -
Install MongoDB for a database server. It is recommended that you add the MongoDB
binfolder to your PATH environment variable.
- Install Node.js and npm as stated in step 1 above.
- Install React Native CLI using
npm install -g create-react-native-app - Install Expo CLI using
npm install -g exp - Install all project dependencies by navigating to
mobile/and runningnpm install
- Navigate to the folder titled 'rest-api' and run the command
swagger project start, this starts the rest-api which we will interact with both from the client and the server. - Run a mongodb database server. On Linux, open a new terminal and type
mongod. On Windows, the executable file is something similar to the following path:./Program Files/MongoDB/Server/{version}/bin/mongod - Navigate to the project directory and run
ng build --watch. This builds the project and also watches the client side for changes. - Navigate to the project directory and run
nodemon, this starts the web server along with socket.io on two separate ports. This also watches the server for changes.
- Navigate to the folder
mobile/and run the commandexp start. - Install the Expo application on your phone using either Google Play Store or App Store
- Scan the displayed QR code using the Expo app.
Navigate to 'rest-api' folder and run swagger project edit, this allows us to edit and test our rest-api using swagger's slick interface.
To setup environment variables that are specific to the project, navigate to the folder environments under the main project directory. Some variables you can change here include: host, ports, and spotify web api configuration.
Run ng serve to serve the live development server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
We can use the development server for testing any live CSS/HTML changes. Only do a full build when testing the API and mongoDB connections.
Note the development server runs on port 4200 while the full build runs on port 3000.
Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|module.
Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.
The -prod flag can be added to both the ng build and ng serve commands. In components, this will set the global variable environment.production to true. Note that in production, Angular minifys JS and CSS files so the project runs a lot smoother.
Run ng e2e to execute the end-to-end tests via Protractor.
Before running the tests make sure you are serving the app via ng serve.
ng build--ng bng serve--ng sng generate component--ng g c
To get more help on the Angular CLI use ng help or go check out the Angular CLI README.