Set node server (8af02018) · Commits · repos / commtech / AutosuggestSitelink · GitLab
Admin message
How to register an account on GitLab
. Due to spam, new accounts are locked until approved by an admin or
the approver bot
. Your GitLab account gets automatically approved within one hour if you are a member of
Trusted Contributors in Gerrit
, or a member of the
Trusted-Contributors group in Phabricator
and
linked your Developer account ("LDAP") to your Phabricator account
. If none of these apply,
file an unlock request
to expedite access.
Only if you are WMF staff
: Create your GitLab account,
have "Wmf" group membership
in
IDM
link your Developer account ("LDAP") to your Phabricator account
, and get automatically approved.
Admin message
Support:
mw:GitLab
how to host a project on GitLab
#wikimedia-gitlab
on libera.chat,
#GitLab
on Phabricator.
Commit
8af02018
authored
Dec 15, 2022
by
HMonroy
Committed by
MusikAnimal
Dec 15, 2022
Browse files
parent
9c1acd89
Loading
Loading
Loading
Loading
Original line number
Diff line number
Diff line
/**
* Based on https://github.com/wikimedia-gadgets/twinkle/blob/master/scripts/server.js (CC BY-SA 3.0)
* Starts a local server, so you can test your code by importing the src/ directory from your local.
* To use, run "node bin/server.js", then in your https://meta.wikimedia.org/wiki/Special:MyPage/global.js,
* add the following:
* mw.loader.load('http://localhost:5501/src/AutosuggestSitelink.js');
*/
/* global process */
const
http
require
http
);
const
fs
require
fs
);
const
server
http
createServer
request
response
=>
const
filePath
`.
${
request
url
let
contentType
if
request
url
endsWith
.js
contentType
text/javascript
else
if
request
url
endsWith
.css
contentType
text/css
else
contentType
text/plain
fs
readFile
filePath
error
content
=>
if
error
response
end
`Oops, something went wrong:
${
error
code
..\n`
);
else
response
writeHead
200
Content-Type
contentType
);
response
end
content
utf-8
);
);
);
const
hostname
127.0.0.1
const
port
isNaN
Number
process
argv
5501
process
argv
];
server
listen
port
hostname
()
=>
// eslint-disable-next-line no-console
console
log
`Server running at http://
${
hostname
${
port
/ `
);
);
Original line number
Diff line number
Diff line
@@ -2,12 +2,12 @@
"name"
"autosuggest-linking-wikidata"
"version"
"0.1.0"
"description"
"A tool to suggest sitelinks between wiki pages and Wikidata items"
"main"
"AutosuggestSitelink.js"
"main"
src/
AutosuggestSitelink.js"
"directories"
"doc"
"docs"
},
"scripts"
"test"
"eslint AutosuggestSitelink.js"
"test"
"eslint
bin/ && eslint src/
AutosuggestSitelink.js"
},
"repository"
"type"
"git"
File moved.
View file
Loading
US