Coder Social home page Coder Social logo

autenticacion-front-back-jwt-madridpt18's Introduction

WebApp boilerplate with React JS and Flask API

Open in Gitpod

Styles

You can update the styles/index.scss or create new .scss files inside styles/ and import them into your current scss or js files depending on your needs.

Components

Add more files into your ./src/js/components or styles folder as you need them and import them into your current files as needed.

💡Note: There is an example using the Context API inside views/demo.js;

Views (Components)

Add more files into your ./src/js/views and import them in ./src/js/layout.jsx.

Context

This boilerplate comes with a centralized general Context API. The file ./src/js/store/flux.js has a base structure for the store, we encourage you to change it and adapt it to your needs.

React Context docs BreathCode Lesson view

The Provider is already set. You can consume from any component using the useContext hook to get the store and actions from the Context. Check /views/demo.js to see a demo.

import { Context } from "../store/appContext";
const MyComponentSuper = () => {
    //here you use useContext to get store and actions
    const { store, actions } = useContext(Context);
    return <div>{/* you can use your actions or store inside the html */}</div>;
};

Back-End Manual Installation:

It is recomended to install the backend first, make sure you have Python 3.8, Pipenv and a database engine (Posgress recomended)

  1. Install the python packages: $ pipenv install
  2. Create a .env file based on the .env.example: $ cp .env.example .env
  3. Install your database engine and create your database, depending on your database you have to create a DATABASE_URL variable with one of the possible values, make sure yo replace the valudes with your database information:
Engine DATABASE_URL
SQLite sqlite:////test.db
MySQL mysql://username:password@localhost:port/example
Postgress postgres://username:password@localhost:5432/example
  1. Migrate the migrations: $ pipenv run migrate (skip if you have not made changes to the models on the ./src/api/models.py)
  2. Run the migrations: $ pipenv run upgrade
  3. Run the application: $ pipenv run start

Backend Populate Table Users

To insert test users in the database execute the following command:

$ flask insert-test-users 5

And you will see the following message:

  Creating test users
  [email protected] created.
  [email protected] created.
  [email protected] created.
  [email protected] created.
  [email protected] created.
  Users created successfully!

To update with all yours tables you can edit the file app.py and go to the line 80 to insert the code to populate others tables

Front-End Manual Installation:

  • Make sure you are using node version 14+ and that you have already successfully installed and runned the backend.
  1. Install the packages: $ npm install
  2. Start coding! start the webpack dev server $ npm run start

Publish your website!

This boilerplate it's 100% integrated with Herkou, just by pushing your changes to the heroku repository it will deploy: $ git push heroku main

	// "prettier-webpack-plugin": "^1.2.0",

"dotenv-webpack": "^1.7.0", "friendly-errors-webpack-plugin": "^1.7.0",

autenticacion-front-back-jwt-madridpt18's People

Contributors

alesanchezr avatar colbywtaylor avatar emily-v avatar enaguero avatar hernanjkd avatar jferragut avatar ljavierrodriguez avatar marcogonzalo avatar mojonapower avatar mserrano07 avatar plucodev avatar timrodz avatar tozzigh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.