Skip to content

Becode - Group Work: ReactJS (Front) / Laravel (Back) - Event manager - (Demo on Heroku)

License

Notifications You must be signed in to change notification settings

Raigyo/group-project-react-laravel

Repository files navigation

Becode - Event Dab (Workgroup: Laravel + ReactJS)

Becode logo

March - April 2019

🔨 CRUD Application to manage events online. If you want to know how does it look like check it out on Heroku


Built With

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Getting Started

Prerequisites

You'll need composer and npm to download and install all the dependencies.

You need a PostgreSQL database, if you already have one, you can put your credentials in the .env file in the DB_... section. If you do not have one, you can use docker. The docker-compose.yml is given in the root directory.

Installing

To get a development env running, install all the dependencies with:

composer install && npm install

Don't forget to edit your .env file. If you do not have one:

cp .env.example .env

And modify your credentials. Then generate your jwt key and your app key

php artisan key:generate
php artisan jwt:secret

If you don't have a PostgreSQL you can start the docker-compose.yml file is included up in the root directory

docker-compose up

To start your PHP server use the command (by default the server will start on localhost:8000):

php artisan serve

You can specify a port by using

php artisan serve --port=8080

Or you can simply run the launchscript.sh with:

./launchscript.sh

If it doesn't work, it probably means you have to set the right to execute it.

sudo chmod +x launchscript.sh

Deployment

The project is ready to deploy on heroku, just push this repo to your herokuapp repository. Add you addon for the database with the following :

heroku addons:create heroku-postgresql:hobby-dev

Don't forget to edit the configs with:

  • APP_ENV = production
  • APP_KEY
  • APP_URL = your url
  • DB_CONNECTION = heroku
  • JWT_SECRET
  • MAIL_PASSWORD
  • MAIL_USERNAME

And finally run in the console of your heroku app:

php artisan migrate:fresh

to set your database

Documentation (API)

Authentication

POST /register

Only takes a JSON as input.

{
    "name":"yourName",
    "email":"yourEmail",
    "password":"yourPassword"
}

Return your token.

POST /login

Only takes a JSON as input.

{
    "email":"yourEmail",
    "password":"yourPassword"
}

Event

Event object

  • id: The identifier of the event as an integer.
  • name: The name of the event.
  • date_event: The date of the event.
  • author: The identifier of the user that created the event.
  • description: A description of the event.
  • reminder: A date to know when to send a notification for all the participant at the event.
  • image_url: A link to the image that you want for the event.

For every route where you have to be logged in, you simply have to add to your request the following header:

{
    'Content-Type': "application/json",
    'Authorization': "Bearer " + "your token"
}

GET /events

Returns a complete list of all the events.

GET /myEvents

(must be logged) Returns a complete list of all the events you created.

GET /myParticipation

(must be logged) Returns a complete list of all the events you created.

GET /pastEvent

Returns a complete list of all the events that are already finished.

GET /futurEvent

Returns a complete list of all the events that are yet to come.

GET /event/:id

Returns a event by id.

PUT /event/:id

(must be logged and the author of the event) Only takes JSON as input.

{
	"name" : "Name of event",
	"date_event" : "YYYY-MM-DD HH:MM:SS",
	"description" : "Your description",
	"reminder" : "YYYY-MM-DD HH:MM:SS",
	"image_url": "url"
}

Updates a event.

POST /event

(must be logged) Only takes JSON as input.

{
	"name" : "Name of event",
	"date_event" : "YYYY-MM-DD HH:MM:SS",
	"description" : "Your description",
	"reminder" : "YYYY-MM-DD HH:MM:SS",
	"image_url": "url"
}

Creates a new event. Returns the newly created event id.

POST /inscription/:id

(must be logged) (Id is the id of the event) Allows the user to subscribe to an event.

POST unsubscribe/:id

(must be logged) (Id is the id of the event) Allow the user to unsubscribe to an event.

About

Becode - Group Work: ReactJS (Front) / Laravel (Back) - Event manager - (Demo on Heroku)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •