Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

demoon

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

demoon

Lua + Node

  • 0.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

demoon

You love Lua but the runtime API is very weak and you don't want to handle and learn a lot of different luarock libraries? You came at the right place! This project aims to offer the bests of Lua and NodeJS together.

Usage

You don't need lua installed to run demoon, but you need node and npm as well, firstly, install demoon globally:

$: npm i -g demoon

Then run it passing your entry lua file:

$: demoon app.lua

Example

This is a little sample code to demonstrate how demoon is powerful and bridges well with nodeJS:

-- you can require node modules (package.json/node_modules works as well)
local http = require('http')

-- you can require js modules and lua files
-- require('./myjsmodule.js')
-- require('./myluamodule.lua')

local port = os.getenv('PORT') or 8080

function sleep(ms)
    -- you can use and create promises
    return Promise.create(function(resolve)
        setTimeout(resolve, ms)
    end)
end

-- top level await works!
sleep(1000):await()

http.createServer(async(function (req, res)
    -- you can await inside async bounded functions
    sleep(1000):await()

    res:write('Hello World!');
    res['end']();
end)):listen(port);

print('Your server is running on port ' .. port .. '!')

Keywords

FAQs

Package last updated on 24 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc