Skip to content

abrarShariar/laravel-angular2-REST

Repository files navigation

laravel-angular2-REST

RESTful backend with Laravel 5.3 and Angular 2 as frontend

  • The ng2 directory hosts the Angular 2 app

  • Other directories/files in the project root belongs to Laravel (5.3)

Getting Up and Running

  • Start PHP's built-in development server for Laravel
	git clone https://github.com/abrarShariar/laravel-angular2-REST.git
	
	cd laravel-angular2-REST
	
	php artisan serve
  • Start lite-server for Angular 2
	cd laravel-angular2-REST
	
	cd ng2

	npm start

RESTful Backend with Laravel 5.3

  • Some of the config files are not in the repo since they are kept as is out-of-the-box.

  • Config your database:

	./config/database.php
	./env
  • Database schema is as follows:
	Schema::create('employee', function (Blueprint $table) {
            $table->increments('id');     //primary key + auto increment
            $table->string('firstname');
            $table->string('lastname');
            $table->date('DOB');
            $table->string('description',100);
            $table->timestamps();       //'created_at' 'updated_at' cols
  • Perform migration:
	php artisan migrate	
	php artisan db:seed --class="EmployeeTableSeeder"
  • Now run php artisan serve in the project root and you will be Up and Running !!

  • API endpoints defined in api.php

	/api/all		//get all employee data		
	/api/show/id=$id	//get specific employee data
	/create			//create a new employee recored
				//authentication required

Angular 2 Frontend

	/employee/all		//show all employee data
	/employee/add 		//add new employee
	/search			//search employee

TO-DO

About

RESTful backend with Laravel 5.3 and Angular 2 as frontend

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published