This project was developed during the Internet programming course.
Technologies | Project | Running the Application | License
This project was developed with the following technologies:
- JavaScript
- Node.js
- Express
- ElasticSearch
- Passport
- HTML
- CSS
- HandleBars
- Jest
- Git
- GitHub
The project's main goal was to design a web application that would allow users to create their own board game playlists. The application has an authentication system so that each user can have an individual experience while navigating through a simple interface that uses the Board Game Atlas API as a source of information.
-
Necessary installations
# Create package.json npm init –y # Module that brings Fetch API to node npm install node-fetch # Framework express npm install express # Middlewares npm install express-session npm install passport # Extension to read and use the template engines in the web-site npm install handlebars # Support for the tests npm install jest --save-dev npm install supertest --save-dev
-
Run Tests
The next step is to open the package.json and change the test property to "jest" in the scripts object. So now we are ready to run the tests of the application.
Navigate into your new site’s directory and start it up.npm run test
-
Choose How to store data.
You should open the borga-server.js file and comment the option that you don’t want.
# Memory const borgaData = require('./borga-data-mem.js') # ElasticSearch const borgaData = require('./borga-db.js')
-
ElasticSearch
If you choosed the db option, the application is gonna use ElasticSearch, so it will be necessary a previous installation of the package but also to execute some commands in the shell to create the documents necessary to support the application. Also, if you don't have Curl might consider installing it for managing your accounts in the application.
Install ElasticSearch
Install Curl# Start ElasticSearch elasticsearch # Delete to prevent data overlap curl -X DELETE http://localhost:9200/users curl -X DELETE http://localhost:9200/groups # Insert both documents in curl curl -X PUT http://localhost:9200/users curl -X PUT http://localhost:9200/groups # Create an admin account curl -X POST --data "{\"userName\" : \"admin\", \"password\" : \"admin\", \"token\" :\"3fa85f64-5717-4562-b3fc-2c963f66afa6\" }" -H "Content-Type: application/json" http://localhost:9200/users/_doc # Create a group for the admin curl -X POST --data "{\"name\" : \"MyGroup\", \"description\" : \"Administration Group\", \"games\" : [], \"userName\" : \"admin\" }" -H "Content-Type: application/json" http://localhost:9200/groups/_doc
-
Start application
Open the shell in the applications directory and start it up!
node borga-server.js
Your site is now running at http://localhost:8080
This project is under the MIT License.
Developed by Tiago Cebola & Gustavo Campos & Inês Sampaio, belonging to the LEIRT61D class at ISEL. 👋