Added server endpoint

This commit is contained in:
Anton Gunov
2017-06-30 14:55:33 +07:00
parent 2c7331e7cd
commit 87749b9e5c
7 changed files with 56 additions and 3 deletions

2
.env.example Normal file
View File

@@ -0,0 +1,2 @@
NODE_PORT=5000
NODE_ENV=development

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
.*/
node_modules/
.env

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017 antongunov
Copyright (c) 2017 Anton Gunov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,2 +1,7 @@
# favicongrabber
A simple tool to grab favicons
# Favicon Grabber
A simple tool to grab favicons.
## License
The code is available under the [MIT License](LICENSE).

12
package-lock.json generated Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "favicongrabber",
"version": "0.1.0",
"lockfileVersion": 1,
"dependencies": {
"dotenv": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-4.0.0.tgz",
"integrity": "sha1-hk7xN5rO1Vzm+V3r7NzhefegzR0="
}
}
}

15
package.json Normal file
View File

@@ -0,0 +1,15 @@
{
"name": "favicongrabber",
"version": "0.1.0",
"description": "A simple tool to grab favicons",
"repository": "https://github.com/antongunov/favicongrabber.git",
"private": true,
"author": "Anton Gunov <anton@gunov.name>",
"license": "MIT",
"scripts": {
"start": "node -r dotenv/config server/server.js"
},
"dependencies": {
"dotenv": "^4.0.0"
}
}

15
server/server.js Normal file
View File

@@ -0,0 +1,15 @@
/**
* Favicon Grabber
*/
const http = require('http');
const NODE_PORT = parseInt(process.env.NODE_PORT, 10);
const srv = http.createServer((req, res) => {
res.end('Hi!');
});
srv.listen(NODE_PORT, () => {
console.log(`Server listening on port ${NODE_PORT} in ${process.env.NODE_ENV} mode...`);
});