An Api For Serving Coffee Machines & Coffee Pods Data For An Ecommerce Mobile App Client.
- Node.js w/ express
- MongoDB
- Mongoose
- Postman
- Git w/ github
To be able to run the project successfully you need to have the following installed:
- You can install MongoDB Server from their official website.
- Or you can use a remote DB (Use Atlas for example).
- You Have to specify the connection string in the "config.env" file.
- You have to install npm globally on your machine.
- You can install npm from the
npmjs
website.
You need to create an environment variables file named config.env
in the root directory, there is an example environment variables file in the root directory, namely .env.example
. Please make sure to correctly fill the env variables to avoid runtime errors.
You can use the same "config.env" as mine. Just copy the following and paste in yours:
#Node Enviroment Configuration #development or production NODE_ENV=production #Server Port Configuration PORT=8000 #Database Configuration DATABASE=mongodb://localhost:27017/Coffee_Company #Database_Query_Default_Pagination_Limit #[Default Number Of Documents To Be Retrieved From DB If "Limit" Was Not Specified In The Query String] QUERY_PAGINATION_LIMIT=10
- run 'npm install'
- You might need to run the seeder script (check the database seeding section for more details) or you can insert data manually using the insert endpoints (Check the api documentation for more details.).
- run 'npm start'
To seed an empty database before running the project you should run npm run seed
, this will use the prewritten seeds stored in ./seeder/seeds.js
to seed your database.
NOTE!: this script wipes the database before it starts seeding.
I use Postman
for generating the API documentation, so the documentation is hosted on a remote webpage