Skip to content

Project developed for the Next Level Week event by Rocketseat.

Notifications You must be signed in to change notification settings

arturo32/NextLevelWeek

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NextLevelWeek - Ecoleta

Project developed for the Next Level Week event by Rocketseat.

Overview

This project it's about a site that allows you to register a recycling collection point, so people can find one more easily in their city. It is divided in two parts: the back-end, an restful API made with NodeJS, Express (for HTTP requests) and Knex (for database queries), and the front-end, made with ReactJS. MySQL was used instead of SQLite for the database management.

What I did differently

Besides the change in the database manager, I did two more main alterations:

Map

The original project have a map from the Leaflet API and selection boxes with IBGE API data in them (city and states from Brazil). I have added one more, the Nominatim API, that can give coordinates of an address and vice-versa. That way, from a click in the map, I can give the state, city and street of a point.

Responsiveness

The original site wasn't very responsive to different windows sizes. I fixed that with a bit of CSS, messing around with media queries and Flexbox properties.

How to run

Type the following commands in your terminal:

# Clone the repository
$ git clone https://github.com/arturo32/NextLevelWeek.git
# Enter the repository
$ cd NextLevelWeek

API

In the files NextLevelWeek/server/src/database/connection.ts AND NextLevelWeek/server/knexfile.ts make sure that "user" and "password" are set accordingly with your user and password of MySQL.

Next, create a database named "ecoleta" in MySQL. If you use MySQL in the terminal, open another terminal and type:

# Enter MySQL
mysql -u root -p
# Create database
CREATE DATABASE ecoleta;

Then, back to your first terminal, type the following commands:

# Enter the server folder
$ cd server
# Install the dependencies (using npm or yarn)
$ npm install || yarn install 
# Fill the proffy database with tables using knex (with npm or yarn)
npm run knex:migrate || yarn knex:migrate
# Run the app (using npm or yarn)
$ npm run dev || yarn dev 

If you find problems with the npm run knex:migrate (ER_NOT_SUPPORTED_AUTH_MODE), then you have to type the following commands in another terminal:

# Enter MySQL
mysql -u root -p
# Create database
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Where password will be your current password (or new password!) for root access of MySQL.

Access API through http://localhost:3333/

Web

# Enter the web folder
$ cd web
# Install the dependencies (using npm or yarn)
$ npm install || yarn install 
# Run the app (using npm or yarn)
$ npm start || yarn start 

Access in your browser through http://localhost:3000/

About

Project developed for the Next Level Week event by Rocketseat.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •