c742435
V2EX  ›  问与答

求推荐快速写出一个极为简单的服务器的方法

  •  
  •   c742435 · Oct 23, 2015 · 4152 views
    This topic created in 4050 days ago, the information mentioned may be changed or developed.

    基本会用 java 和 python , js 查查 google 估计也能写。其他的后端技能基本为 0
    现在需要实现一个分发页面:
    访问请求带有一个固定的 id 。查询数据库以确定将用户分发到什么地址,然后 302 过去。
    其他的功能慢慢加,比如 log 。
    请问有什么推荐的框架吗,或者裸写?

    20 replies  •  2015-10-24 00:35:00 +08:00
    jmc891205
    jmc891205
    Oct 23, 2015❤️1
    1
    node.js
    F281M6Dh8DXpD1g2
    F281M6Dh8DXpD1g2
    Oct 23, 2015❤️1
    2
    ruby sinatra

    require 'sinatra'

    get '/' do
    if params[:id ] == 1
    redirect_to :your_url
    end
    end

    搞定收工
    virusdefender
    virusdefender
    Oct 23, 2015 via Android❤️1
    3
    python 裸写就行

    实在不会加一个 bottle
    C0VN
    C0VN
    Oct 23, 2015❤️1
    4
    flask 吧,非常直观!你这个写几个 URL 路由加 sql 语句就差不多了

    http://flask.pocoo.org/
    zhujinliang
    zhujinliang
    Oct 23, 2015❤️1
    5
    golang ?
    fire5
    fire5
    Oct 23, 2015 via Android❤️1
    6
    推荐 flask
    learnshare
    learnshare
    Oct 23, 2015❤️1
    7
    Express (Node.js)
    c742435
    c742435
    OP
    Oct 23, 2015
    8
    谢谢大家 用 flask 了
    uleh
    uleh
    Oct 23, 2015
    9
    apt-get install nginx
    c742435
    c742435
    OP
    Oct 23, 2015
    10
    @uleh nginx 写逻辑怎么搞
    ryd994
    ryd994
    Oct 23, 2015 via Android
    11
    @xavierskip
    @fire5
    bottle 轻一点,简单应用用起来差不多

    @c742435 Nginx 查数据库会比较难,但是如果单纯判断 id 段的话,用写个小 lua 应该不难
    msg7086
    msg7086
    Oct 23, 2015 via Android
    12
    @c742435 lua 走起,而且性能超强。
    doublleft
    doublleft
    Oct 23, 2015
    13
    poorguy
    poorguy
    Oct 23, 2015
    14
    既然会 java 或 python ,为何不从这两种语言的 web 框架入手。感觉 python 的 flask , web.py 等都很适合入门阿
    imydou
    imydou
    Oct 23, 2015
    15
    php -S localhost:8080
    esile
    esile
    Oct 23, 2015 via iPhone
    16
    php 你值得拥有
    qianlv
    qianlv
    Oct 23, 2015
    17
    sudo python -m SimpleHTTPServer 80
    saber000
    saber000
    Oct 23, 2015
    18
    fengjianxinghun
    fengjianxinghun
    Oct 23, 2015 via iPad
    19
    @c742435 nginx lua 模块。。我直接就在 nginx 里写 web
    snnn
    snnn
    Oct 24, 2015 via Android
    20
    同上。 ATS 加 lua
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3730 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 04:04 · PVG 12:04 · LAX 20:04 · JFK 23:04
    ♥ Do have faith in what you're doing.