Report a Bug
πββοΈ
Request Feature
Provides a base for a E-commerce backend, with Items to display and Payments to log. It should provides the frontend with enought data to be functional.
This project have as a primary function to provide a base for a demostration on how to detect a credit card issuer/network. Later I can re use it by adding features, for example the ones describes later.
Card type detection using regex for a credit card form component. As managing money for programmers is important, we have to make sure things like card issuer are as the user says; also we have to take care of the looks.
This projects shows how to check in a Rails controller's method for the Network issuing certain cards based on the Issuer identification number (IIN). This way we take care of security issues validating server-side the card number.
Based on this gist
- ruby v2.7.x
- rails v6.0.x
rbenv
v1.1.x- vscode with Ruby and Rubocop extensions
- Linux MX (Debian 10/XFCE)
- Love and Passion for code.
- Using Rails 6.x
- No views, only API
- Using postgres databases for development and production (postgres)
- Uses migrations and seed
- Associates several tables on the database using foreign keys
This project was bootstrapped with Ruby on Rails. So is already setup to be wasily developed and run.
You will need Ruby on Rails version 6.0 or greater installed on your system.
Get the code by either cloning this repository using git
git clone [email protected]:Israel-Laguan/shopeasy-ruby-backend.git
... or downloading source code as a zip archive.
Once downloaded, open the terminal in the project directory, and install dependencies with:
bundle
Provide a .env
file the keys ``
rails db:reset && rails db:reset RAILS_ENV=test && rails db:migrate && \
rails db:migrate RAILS_ENV=test
Run tests with bundle exec rspec
Run rails db:seed
to generate seed data.
Then start the app with:
rails s
The app should now be up and running at http://localhost:3000 π
If for some reason you have a server running in that same port just change the port with rails server -p XXXX, where XXXX is any number greater than 1024 (below that we have permission troubles). For example 3001 could work.
To run the tests that verify the proper behavior of the Rails app, run the following command. There are about 119 passing specs, this should make you stop worrying about a malfunction in the app.
rspec
- Add Swagger
- Add User Auth with Devise and OnmiAuth
- Improves Active Record's Queries
- Add more tests
- Items
- Payments
- How to migrate or Seed my Heroku's Postgres DB?
You must use Heroku CLI (more info here). Try these commands:
heroku run rails db:migrate
heroku run rails db:seed
- My Postgres gem (
pg
) don't compile π’
You must install system dependencies for Postgres. In Debian try this:
sudo apt update
sudo apt-get install zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev postgresql-client-common postgresql-client libpq-dev
π€ Contributions, issues and feature requests are welcome! Feel free to check the issues page.
π€ Give a βοΈ if you like this project!
Regexs: Adapted form here
π This project is licensed under the Apache 2
Feel free to fork this project and improve it