Add sample node.js/express server

parent 473a8a74
node_modules/
config.json
\ No newline at end of file
Ce projet est le générateur de slogan et d'image utilisé par LQDN pour la campagne de dons 2017-2018.
\ No newline at end of file
# Slogans generator
This project is the slogan generator used by LQDN for the donation compaign of years 2017-2018.
## Installation
The back-end server require node.js, npm and cairo. Here is the installation command for debian based systems:
```sh
apt install nodejs libcairo2-dev libjpeg62-turbo-dev libpango1.0-dev libgif-dev build-essential g++
```
```sh
cp config.json.default config.json
npm install
```
## Run
```sh
npm run
```
{
"port": "3000"
}
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@3.10.10
3 info using node@v6.11.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle generateur-slogans@1.0.0~prestart: generateur-slogans@1.0.0
6 silly lifecycle generateur-slogans@1.0.0~prestart: no script for prestart, continuing
7 info lifecycle generateur-slogans@1.0.0~start: generateur-slogans@1.0.0
8 verbose lifecycle generateur-slogans@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle generateur-slogans@1.0.0~start: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/emeraude/projects/generateur-slogans/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
10 verbose lifecycle generateur-slogans@1.0.0~start: CWD: /home/emeraude/projects/generateur-slogans
11 silly lifecycle generateur-slogans@1.0.0~start: Args: [ '-c', 'srv.js' ]
12 info lifecycle generateur-slogans@1.0.0~start: Failed to exec start script
13 verbose stack Error: generateur-slogans@1.0.0 start: `srv.js`
13 verbose stack spawn ENOENT
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:33:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:920:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid generateur-slogans@1.0.0
15 verbose cwd /home/emeraude/projects/generateur-slogans
16 error Linux 4.9.0-3-amd64
17 error argv "/usr/bin/node" "/usr/bin/npm" "start"
18 error node v6.11.3
19 error npm v3.10.10
20 error file sh
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn
24 error generateur-slogans@1.0.0 start: `srv.js`
24 error spawn ENOENT
25 error Failed at the generateur-slogans@1.0.0 start script 'srv.js'.
25 error Make sure you have the latest version of node.js and npm installed.
25 error If you do, this is most likely a problem with the generateur-slogans package,
25 error not with npm itself.
25 error Tell the author that this fails on your system:
25 error srv.js
25 error You can get information on how to open an issue for this project with:
25 error npm bugs generateur-slogans
25 error Or if that isn't available, you can get their info via:
25 error npm owner ls generateur-slogans
25 error There is likely additional logging output above.
26 verbose exit [ 1, true ]
{
"name": "generateur-slogans",
"version": "1.0.0",
"description": "Ce projet est le générateur de slogan et d'image utilisé par LQDN pour la campagne de dons 2017-2018.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "./srv.js"
},
"repository": {
"type": "git",
"url": "gitlab@git.laquadrature.net:lqdn-interne/generateur-slogans.git"
},
"license": "GPL-3.0",
"dependencies": {
"canvas": "^1.6.7",
"express": "^4.16.1"
}
}
#!/usr/bin/env node
const express = require('express');
const app = express();
const config = require('./config.json');
app.get('/generate', function (req, res) {
res.send('Hello World!');
})
app.listen(process.env.PORT || config.port || 80, function () {
console.log('Example app listening on port ' + config.port);
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment