NerdLang/nerd

I can't compile

Opened this issue · 4 comments

I want to compile a code, it is for node js, but the nectar looks like this error:

[!] Warning : index file of module ./lib/express seems empty
/usr/local/lib/node_modules/nectarjs/node_modules/@babel/core/lib/parser/index.js:95
    throw err;
    ^

SyntaxError: unknown: Unexpected token (104:16)

  102 | 'use strict';
  103 |
> 104 | module.exports =;
      |                 ^
  105 | return module.exports;
  106 | };
    at Parser._raise (/usr/local/lib/node_modules/nectarjs/node_modules/@babel/parser/lib/index.js:775:17)
    at Parser.raiseWithData (/usr/local/lib/node_modules/nectarjs/node_modules/@babel/parser/lib/index.js:768:17)
    at Parser.raise (/usr/local/lib/node_modules/nectarjs/node_modules/@babel/parser/lib/index.js:736:17)
    at Parser.unexpected (/usr/local/lib/node_modules/nectarjs/node_modules/@babel/parser/lib/index.js:9699:16)
    at Parser.parseExprAtom (/usr/local/lib/node_modules/nectarjs/node_modules/@babel/parser/lib/index.js:11091:20)
    at Parser.parseExprSubscripts (/usr/local/lib/node_modules/nectarjs/node_modules/@babel/parser/lib/index.js:10668:23)
    at Parser.parseUpdate (/usr/local/lib/node_modules/nectarjs/node_modules/@babel/parser/lib/index.js:10648:21)
    at Parser.parseMaybeUnary (/usr/local/lib/node_modules/nectarjs/node_modules/@babel/parser/lib/index.js:10626:23)
    at Parser.parseExprOps (/usr/local/lib/node_modules/nectarjs/node_modules/@babel/parser/lib/index.js:10487:23)
    at Parser.parseMaybeConditional (/usr/local/lib/node_modules/nectarjs/node_modules/@babel/parser/lib/index.js:10461:23)

code:

const express = require('express')
const app = express()
const port = 4444
Info = []
const args = process.argv.slice(2)
site = args[0]


function getIp(req){
  var ip = (req.headers['x-forwarded-for'] || '').split(',')[0] || req.connection.remoteAddress;
  if (ip=='::1'){
    return "localhost"
  }
  return ip
}


app.get('/', (req, res)=>{
  Info.ip = getIp(req)
  res.redirect(site)
  console.log(Info.ip, "->", site)
})


app.listen(port, ()=>{
  console.clear()
  console.log(`Server: http://localhost:${port}`)
})

Hi @gabhm ,
We do not fully support expressjs for now

Do not hesitate to help us make it work

hello ❤️ , does it support the normal http module of the java script?
I think I can try to help you (if my English is bad, and because it's not my native language ...)

Yes we started to support some functions of http modules, you can check the examples for examples

Yes we started to support some functions of http modules, you can check the examples for examples
thank you very much for your attention, I will see the code and try to create something that improve in the project.