Code Monkey home page Code Monkey logo

tg970 / pern-advanced-starter Goto Github PK

View Code? Open in Web Editor NEW
54.0 5.0 61.0 15.89 MB

Advanced PERN stack starter kit (PostgresSQL, Express, React, & Node), complete with ESLint, Webpack 4, Redux, React-Router, and Material-UI kit.

Home Page: https://pern-starter.herokuapp.com/

License: MIT License

JavaScript 72.49% HTML 0.25% CSS 0.09% SCSS 27.18%
node express postgresql react redux react-redux react-router react-router-dom material-ui material-design

pern-advanced-starter's Introduction

Known Vulnerabilities

PERN-Advanced-Starter

The PERN stack: PostgresSQL, Express, React, & Node

Live example: PERN-Starter

What makes this an advanced starter app you ask? This project folds together several tools that come together for a powerful dev environment and good start for a fully functional production application. It employs an 'advanced' implementation of pg-promise for interaction with a SQL database with additional basic security concerns added to the Express server.

Here's a list of the other fun bits folded into this project:

  • ESLint: Style guide, syntax, and developer error finder and enforcer
  • Webpack: Static module bundler, complier, & hot-reloader
  • Redux: Predictable state container/manager for JavaScript apps
  • React-Router: “Dynamic Routing” (navigation) for React client
  • React Material UI: Component library implementing Google's Material Design
  • Material-UI Kit: Curated mid-level component library complete with view examples
  • Axios: Promise based HTTP client for the browser and node.js

Using this project

First, make sure you have have PostgreSQL installed and running. Visit the PostgreSQL home page for more info and to download the install file.

Open a terminal window and create a new PG database:

$ createdb PERN-Starter

Then to get going using this starter app, first fork the repo:

fork

Then clone the fork to your local machine:

$ git clone https://github.com/*YOUR-USERNAME-HERE*/PERN-Advanced-Starter.git

Why fork? That way you can make your own changes, save them to github, and even share them with the main fork.

Hop into the project directory and install the dependencies:

$ cd PERN-Advanced-Starter
$ npm i

audit report If you have npm v6+ installed and notice there were more than 0 vulnerabilities are found, run: npm audit fix

This is a constant battle: check your dependencies regularly and update them. More about npm's audit functionality here.

To start the Webpack dev server run:

$ npm run dev

And to build for deployment/production run:

$ npm run build
$ npm start

Also don't forget that your API won't work unless you create a users table.

Does this look familiar? no tables

To do this hit the following route, either in your browser or with Postman.

http://localhost:3000/api/users/create

Successful return: null

If you want to seed use:

http://localhost:3000/api/users/init

Successful return: id's

And if you don't have it: json formatter for chrome.

What's happening under the hood

pg-promise: Read up on it.

Other Config files:

.babelrc - Babel is a toolchain used by Webpack to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript for old browsers or environments. This file tells Babel our presets and plugins.

.eslintrc.json - This config file tells ESLint our settings for interpreting and reporting errors and warnings while we're writing our code. Delete or add rules, change style guide, whatever you want, this is where you do it. For this to work you'll need to make sure you have a linter and eslint installed in your code editor.

nodemon.json - When Webpack spins up a dev server it also starts nodemon in the background to proxy for api calls. This file tells nodemon which directory to watch for changes and restart when files are updated.

.webpack.config.js - Oh the magic of Webpack! This file gives Webpack all the important details for doing what it does. Again this file is configurable; for more information visit the configuration docs.

How did we get here?

There are so many resources out there to help developers resolve issues and build new skills and tools. I'm very thankful for the sharing of knowledge and I wanted to put this project together to help other devs that are hoping to try their hand at a full-stack React application.

This starter app was inspired and guided by the following resources:

pern-advanced-starter's People

Contributors

tg970 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pern-advanced-starter's Issues

Module build failed (from ./node_modules/babel-loader/lib/index.js):

I git clone, npm i, created db and table, then I run npm run dev but it fails...

Module build failed (from ./node_modules/babel-loader/lib/index.js):
[1] SyntaxError: Unexpected token (9:2)
[1]
[1] 7 |
[1] 8 | render(
[1] > 9 | ,
[1] | ^
[1] 10 | document.getElementById("root")
[1] 11 | );
[1] 12 |

You should rewrite this in Rust for performance

I hate to be that guy but I must be that guy now. It is for the greater good. I am sure that you understand:

"If you used Rust this would not be a problem.
Python is not that more productive than Rust after all."
-- That Guy

This statement only works though if all source is written in Rust. Mixes like with C++ always do not work well and drag in again all the bad things. Anyways. So I am aware that even if the devs wanted to it would not be an easy task at all. This is still worth as a general anti C++/Python message. And since I had to get through this installation none sense and this AI still does not work for me. I am afraid that you have now to listen to my dismay and other utter terror of lack of order for having dared to leave Rust lands.

I wrote plenty of lines of simple Rust source. Python is not going to be anymore productive than this so called "system language". Rust only sounds scary in its majestic title but is often used for a lot of things that got nothing to do with "system". Simple code in Rust is essentially like Java, C# or Python for that matter.

I do understand that these libraries are not only Python but also C++ which is the worst. However. It should be far more doable to get rid of Python first. Python is 31 years old. That is 310 years in silicon valley time. Rust had pattern matching since birth while Python only got it now for a year or so. It is time to upgrade and write real software. I do not see how Python/C++ could beat Rust's module system called Cargo and its database of Crates on crates.io. The only thing that might be a problem is the maturity of a Crate but certainly not the system itself.

I had a 1GB download for this "installation" just for some Python API. That is not how packing works, folks, That is how Python/C++ works. In Rust only the stuff used ends up in the binary. For Rust's Cargo itself an installation is not required either unlike with Conda. Rust's RustUp(Cargo/Compiler/Format/Doc, etc) is only used to for build time. You know. Like a real programming language for real software. Though this also goes back to C++ not only Python and its lack of an actual package system.

You can use Rust with VSCode easily too. No need for CLion or Visual Studio.

My own game logic/game engine project replaced C/C++/C# for good. GLSL and HLSL will be next. This treachery continues with GLSL and HLSL. And since I am also intending to use ML AI code for my own game beyond this text/image. That puts Python into my way again. Hence again a general anti C++/Python message. For higher level systems like a game you do not want to mess with a bazillion languages/APIs/tools if you can have only one. So this issue may not affect others as much as me. But now you are warned as to why I am not taking this lightly because I am the fool who as to learn and use: C/C++/C#/HLSL/GLSL/Python/Bison/Shmyson/Your Mom's Script

... and eventually yet another pile of **** that humanity made to solve one problem: How To Instruct A Computer To Do Things

I am not amused: -.-

My First Experience With Python

I hate to nag but I am afraid I have to share my initial experience with this productive programming language that I hear people talking about. And I have the feeling that more people will complain because AI is very wide spread these days and will spread way further. So way more people will get exposed to this.

As someone who also mods games I encountered many more languages than just C, C++, C#, F# , HLSL, GLSL, and of course Rust (One Language to Rule Them All) for game development. But I also for modding Java, Doom 3's C like script, World of Warcraft's LUA and now Python for so called scripting.

Judged by the time how long it takes(it still does not work for me) to execute simple code in txt2img.py(which should have been a CLI binary). Python by far is the worst thing I ever had to deal with in my entire life.

I tell you this: Lua and Python are a hoax like all non compiled languages. Their interpretive nature is of no good at all. Compiled languages like Java and C# are certainly better in all regards for so called scripting needs. Rust too actually.

Now to Python. After countless pip install commands One got 700MB of waste downloaded. Pure Rust source would pick only used code and compile it into the binary. No need for CMake or Condo which require their own install too again. One pip install imwatermark did install but not resolve its not found problem. I used a modified txt2img.py (taken from SD UI) without it and ran into a compilation error during startup. It says:
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self.face_rec_model_path)?

I am sorry but what? Language versioning issues? A travesty like C/C++ at this point would have too already allowed me to execute its CLI binary. But not the productive language I hear so much about....

Python has no semicolons.
Maybe try F# instead of Python.

Python uses RETURN keyword. Rust does only in very special cases so mostly not at all.
Maybe try F# instead of Python.

Python uses GC. Rust has no GC and no simple code will require explicit life times to handle the Borrow Checker I think
Borrow Check is why Rust does not require a run time GC to handle memory automatically.
If you love GC try F#.

F# wins...

The list goes on with Python giving only then to take more back. That is not productive. That is a hoax. C and C++ does actually a similar thing with its compile times. They fool new programmers by giving the impression that they are easier to learn than Rust. Which is true for a Hello World+. But. Only then to force you to do debugging later(or handling dependencies later) during the worst time which is run time.

That is why Rust has a much steeper learning curve than C and C++ but it flattens out later to a C# and Java level of ease and productivity. Though the compile times are still rather long with longer code. Seems though the Rust compiler does not do multi threading much so there is room for improvement at least. But I am not hoaxing. Honestly Rust compiler ALWAYS will be at least a bit slower than all other compilers because it simply does more during that stage. Good thing that AMD is making faster CPUs these days... But frankly it is not that bad because it creates a massive amount of certainty that other languages do not provide.

Conclusion (2022/October/03)

This is all you have?

One half is chatbots.
The other half is off topic comments that got nothing to do with any kind of language so are off topic spam.

This is what your degree of "higher education" can produced regarding the languages Rust and your very own language Python that you know so much about?

You can not control what you do not understand. But spam is not hard to understand.... You are doomed...

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.