Skip to content

calweb/api-driven-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-driven-demo

This repo is a demo of an api driven application, using JWT's for authentication and a mongodb backend.

There are many benefits of building an API driven application, notably for its ability to be consumed by many different types of clients (eg. mobile, web, IoT).

Contained in this repo:

  • frontend/ - frontend javascript in the browser
  • backend/ - our api built on Nodejs, MongoDB, Express and various middlewares.

Running

Using Docker

The repository can be run without much setup using Docker/docker-compose.

You'll need to install Docker for Mac, Docker for Windows, or Docker for Linux

Once Docker is installed, you will be able to build and run docker-compose (bundled with docker)

Type:

docker-compose build
docker-compose up

That's it, you should be able to open your browser to view the application http://localhost:3000 for the frontend and http://localhost:8000 for the backend.

Running Each folder separately

You will first need:

  • mongodb
  • Nodejs v8.0
  • npm v5.0

Alternatively, you can open two terminal sessions and navigate to each respective folder, frontent/ and backend/, respectively.

First, make sure your mongodb server is running, usually by mongod or brew services start mongodb

Then, for your backend:

cd backend/
npm install
npm run dev // to use nodemon with dotenv
// will start backend on http://localhost:8000

NOTE: If running dev, you will want to create a .env file to add your environment variables, TOKEN_SECRET, MONGO_URI

For frontend (which is served by express static in nodejs)

cd frontent/
npm install
npm start
// will server static frontend on http://localhost:3000

Information

Package
Description
Node Version ~ 8.0.0

Usage

Contributions

This Project follows the StandardJS style guide.

js-standard-style

To Contribute:

  • Clone Repo
  • npm install
  • Write Code
  • Write Test(s)
  • Submit Pull Request

License

_api-driven-demo is available under the MIT license.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •