Code Monkey home page Code Monkey logo

blog-fullstack-hooks's Introduction

Blog

  • Full Stack Blog application where the user can create a post, read and delete, also add and delete comments.

Technologies:

  • React-Hooks (no classes) and Hook-forms
  • Express.JS
  • PostgreSQL
  • Material UI

The frontend environment of this project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

Prepare database:

Connect to database:

$ psql -h localhost -U postgres -d postgres

Create a new role:

postgres=# CREATE ROLE blog_user WITH LOGIN PASSWORD 'password';
postgres=# ALTER ROLE blog_user CREATEDB;

Logout of the root user (postgres) and connect with new user:

$ psql -h localhost -d postgres -U blog_user

or

$ psql postgresql://blog_user:password@localhost:5432/blogs_api

Create a new database and connect to it:

postgres=# CREATE DATABASE books_api;
postgres=# \c blogs_api

Create tables:

CREATE TABLE posts (
  id SERIAL PRIMARY KEY,
  title VARCHAR(255) NOT NULL,
  body VARCHAR(400) NOT NULL,
  date_created TIMESTAMP
);

CREATE TABLE comments (
    id SERIAL PRIMARY KEY,
    post_id INT,
    comment VARCHAR(255) NOT NULL,
    date_created TIMESTAMP,
    CONSTRAINT fk_blog
      FOREIGN KEY(post_id)
    REFERENCES posts(id)
);

blog-fullstack-hooks's People

Contributors

suzanamelomoraes avatar

Watchers

James Cloos avatar  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.