GithubHelp home page GithubHelp logo

jaywcjlove / sgo Goto Github PK

View Code? Open in Web Editor NEW
208.0 18.0 42.0 1.16 MB

A dev server for rapid prototyping. Setting a directory to a static server.It provides a 404 neat interface for listing the directory's contents and switching into sub folders.

Home Page: https://jaywcjlove.github.io/sgo

License: MIT License

JavaScript 9.20% TypeScript 38.94% EJS 51.86%
mock-server nodejs proxy-server ssr mocker-api server typescript sgo server-go javascript

sgo's Introduction

简体中文

sgo logo

Build & Deploy Issue Forks Stars Releases npm version

A dev server for rapid prototyping. It provides a neat interface for listing the directory's contents and switching into sub folders.

In addition, it's also awesome when it comes to serving static sites. If a directory contains an index.html, serve will automatically render it instead of serving directory contents, and will serve any .html file as a rendered page instead of file's content as plaintext.

Rename: ssr => sgo
sgo: Server Go

⚠️ ssr package has been donated to a certain team in Ali.

Features

🗂 Serve static content like scripts, styles, images from a directory.
🖥 Reroute all non-file requests like / or /admin to a single file.
♻️ Reload the browser when project files get added, removed or modified.
📚 Readable source code that encourages learning and contribution.
💥 Remove the redundancy proxy feature, Please use mocker-api.
⚛️ Preview the static page of the React/Vue/Angular project.


Quick Start

Add sgo as a dev dependency using npm i sgo -D or run directly from the terminal:

npm install -g sgo # install sgo
sgo # Create server
# or
npx sgo [--port] [--dir]

Command help

Usage: sgo [options]

Options:
  --version      Show version number                                   [boolean]
  --port, -p     Set the port.                          [number] [default: 1987]
  --reload-port  Set the reload port.                  [number] [default: 19872]
  --reload, -r   browser from reloading when files change.
                                                       [boolean] [default: true]
  --dir, -d      Specified directory.                     [string] [default: ""]
  --browser, -b  Browser from opening when the server starts.
                                                       [boolean] [default: true]
  --fallback     The file served for all non-file requests.
                                                          [string] [default: ""]
  --help         Show help                                             [boolean]

Examples:

  $ sgo                            Start a dev server.
  $ sgo --no-browser               Prevents the browser from opening when the
                                   server starts.
  $ sgo --no-reload                prevents the browser from reloading when
                                   files change.
  $ sgo --fallback dir/index.html  The file served for all non-file requests..
  $ sgo -p 2019                    Designated port.
  $ sgo -d node_modules/dir        Specified directory "node_modules/dir".

Copyright 2019

Example usage with npm scripts in a project's package.json file:

{
  "scripts": {
    "start": "npx sgo -p 2019"
  }
}

Used in Node.js

const sgo = require('sgo');

// Create server
sgo.default({ port: 1987, dir: '' });
import server from 'sgo';

// Create server
server({ port: 1987, dir: '' });

License

MIT © Kenny Wong

sgo's People

Contributors

dependabot[bot] avatar jaywcjlove avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sgo's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update peaceiris/actions-gh-pages action to v4

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • peaceiris/actions-gh-pages v3
  • ncipollo/release-action v1
npm
package.json
  • chokidar ^3.5.3
  • ejs ^3.1.9
  • fs-extra ^11.1.1
  • get-port ^5.1.1
  • minimist ^1.2.8
  • @types/ejs ^3.1.2
  • @types/fs-extra ^11.0.1
  • @types/minimist ^1.2.2
  • @types/node ^18.15.11
  • @uiw/doc ^4.21.28
  • tsbb ^4.0.1

  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

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.