Coder Social home page Coder Social logo

cesarferradas / shorturls Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 119 KB

A lightweight URL shortener REST API powered by Express and MongoDB

JavaScript 95.90% Dockerfile 0.87% Shell 3.23%
nodejs expressjs mongodb docker rest-api url-shortener

shorturls's Introduction

Build Status

shorturls

A URL shortening REST API.

Install

With Docker

  1. Install Docker

  2. Create a .env file in the project root, and set your environment variables

    cp .example.env .env
  3. Run app

    docker-compose up --build

Manually

  1. Install Node

  2. Install nvm

  3. Use this project's Node version

    nvm use
  4. Install dependencies

    npm install
  5. Install MongoDB

  6. Start MongoDB in the background

    mongod --config /usr/local/etc/mongod.conf --fork
  7. Create admin account for authentication

    mongo
    > use admin
    switched to db admin
    > db.createUser({
          user: "monkey",
          pwd: "password",
          roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
      })
    
  8. Create a .env file in the project root, and set your environment variables

    cp .example.env .env
  9. Start the server

    npm start

Linting

ESLint is configured to run automatically as a pre-commit hook. It follows the Airbnb JavaScript Style Guide.

You can run linting manually with:

npm run lint

Testing

Tests run with Mocha and code coverage is reported with Istanbul. Tests live under the test/ directory, which is Mocha's default path.

To run the test suite:

  1. Create a .env.test file and populate with test values (see .travis.yml)

    cp .example.env .env.test
  2. Run the test script

    npm test

Development

See Issues for outstanding work, and feel free to suggest features!

shorturls's People

Contributors

cesarferradas avatar

Watchers

 avatar  avatar

shorturls's Issues

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.