Coder Social home page Coder Social logo

rackup's Introduction

Local Web Server for AngularJS dan Javascript (Rackup)

  • Install Ruby terlebih dahulu, karena web server menggunakan ruby sebagai server nya

  • pastikan bundler sudah di install di sebagai ruby managemen aplikasi

  • jika belum, install melalui command line : gem install budler

  • buat Gemfile di dalam project, dalam hal ini didalam folder rackup sebagai folder root project

  • Gemfile bisa dibuat menggunakan text editor

  • isi Gemfile :

    source 'https://rubygems.org' gem 'rack'

  • isi Gemfile tersebut berarti kita menginstall rack pada bundler

  • jalan kan : bundle install <====== difolder project

  • akan dihasilkan file Gemfile.lock yang isinya :

    GEM remote: https://rubygems.org/ specs: rack (2.0.3)

    PLATFORMS x64-mingw32

    DEPENDENCIES rack

    BUNDLED WITH 1.15.3

  • buat file config.ru yang merupakan file configurasi webserver sbb:

      	use Rack::Static,
      		:urls => ["/images", "/js", "/css", "/templates"],
      		:root => "src"
    
      	run lambda { |env|
      		[
      			200,
      			{
      				'Content-Type'  => 'text/html',
      				'Cache-Control' => 'public, max-age=86400'
      			},
      			File.open('src/index.html', File::RDONLY)
      		]
      	}
    
  • keterangan root file aplikasi didalam folder src, folder src sejajar dengan config.ru di dalam folder src terdapat folder static seperti /images, /js, /css, /templates, daan folder lain sesuai kebutuhan file index.html ada di dalam folder /src

  • sesudah file config.ru dibuat, server dapat dijalankan dengan perintah : rackup di terminal command prompt

  • Navigate to http://127.0.0.1:9292/ or http://localhost:9292/

rackup's People

Contributors

ekoaripurnomo avatar

Watchers

 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.