Skip to content

jesse-greathouse/shop-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shop Manager

A simple demonstration of a rest API with Laravel

installing the application

First pull the git repository.

$ git clone https://github.com/jesse-greathouse/shop-manager.git

Switch to the shop-manager directory

$ cd shop-manager

Copy the environment file.

$ cp .env.example .env

Now that you have your environment file set up, open your environment file and update the MySQL configs to work in your local environment.

Running the application

Migrations

To initialize the database first run the migrations.

$ php artisan migrate

Seeding the data

To run the application with an already established database, you must first seed the database.

$ php artisan db:seed

Start the Server

This application is for demonstration purposes. Simply run the development server.

$ php artisan serve

Using the application

Postman

It will be easiest to interact with the application via an http request client like Postman.

You can download Postman here.

Import the workspace

In the root of the repository, you will see some files meant for importing into Postman.

You can import the environment files by clicking on the cog-wheel in the upper right-hand corner of Postman. Click the cog-wheel

Then click the import button. Click the import button

Import the environment files:

  • shop-manager-local.postman_environment.json
  • shop-manager-production.postman_environment.json

Import the environment files

Click the import button in the upper-right portion of Postman Click the import button

Under the "Import File" tab, click Choose Files.

Click Choose Files

Import the collection:

  • shop-manager.postman_collection.json

Import the collection

Now you can select the "shop-manager" workspace in postman, and you can also select the environment that you wish to use.

select the collection select your environment

Run requests

With the collection you imported into postman, you can make requests to any of the endpoints of the application. The requests in the collection already have pre-filled POST and PUT variables under the body tab.

Send requests with pre-defined endpoints

Testing the application

Migrate the test database

The application comes equipped with its own database. It requires the use of Sqlite 3. Run the migrations with the following command.

$ php artisan migrate:fresh --env=testing

Seeding the test database

It is not necessary to seed the test database because the tests do not depend on existing data. However if you would like to seed the test database, it is possible with the following command.

$ php artisan db:seed --env=testing

Running the test

As long as the migrations have been ran on the test database, you can run the tests simply with the following command.

$ php artisan test

About

A simple demonstration of a rest API with Laravel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published