Coder Social home page Coder Social logo

desafio-pta's Introduction

How to run this boilerplate

A tutorial on how to create mongodb and cloudinary > accounts, install dependencies and run the project.

1. Install dependencies

Run yarn install or npm install on both client and server folders, this command will install the project's dependencies.

2. Create MongoDB cluster and get the url

  1. If you don't have one, create a mongodb account, then create the cluster for this project.

  2. On the cluster's screen, go to Database Access > Database Users > Add New Database User, then create the user (remember the username and password, we're going to need them later).

  3. Now go to Network Access > Ip Whitelist > Add IP Adress > Current Ip Adress, to add your current ip address to the cluster's whitelist, you will need to do this with every source that will access your database.

  4. The mongo url will be:

    mongodb://[USER]:[PASSWORD]@[SHARD_URL]/[DB_NAME]?ssl=true&replicaSet=[SHARD_NAME]&authSource=admin&retryWrites=true&w=majority

3. Create cloudinary account

  1. Go to cloudinary images website and create an account.

  2. Under the Account Details section is a url named API environment variable this is your cloudinary url.

4. Create a env file

Create a file named .env and, inside of it, place this:

PORT=[PORT]
MONGO_URI=[MONGO_URI]
COOKIE_SECRET=[COOKIE_SECRET]
CLOUDINARY_URL=[CLOUDINARY_URL]

Where:

  • [PORT] is which port you want the server to run on (usually 3001)
  • [MONGO_URI] is the uri you got from step 2.3
  • [COOKIE_SECRET] is a random string used for authentication on the admin.
  • [CLOUDINARY_URL] is the url you got from step 3.2

5. Running in development

To run this project in development mode, we will need to run two servers, the react one on /client and keystone on /server.

The command to run react is yarn start or npm start depending on which tool was used on installation, the react server will run on port 3000 by default.

Before running the keystone server, go to /server/updates/0.0.1-admin.js and change the admin user as you want, this user will be the first created, but you will be able to create others and delete this one later.

To run keystoneJS server, use the command node index.js, the server will run on whatever port is in the variale in the env file, you will find the admin interface in http://localhost:[PORT]/admin

6. Running in production

To run the server in production, go to /client and run the command yarn server, this command will create a react production optimized build and move it to /server.

Then go to /server and run node index.js, you will find the project on http://localhost:[PORT]


Developed by Jorrmungandr

This boilerplate was meant to be used in CITi's selective process on 2020.1, to help the development of onepage websites.


desafio-pta's People

Contributors

vituriano 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.