├── LICENSE ├── package.json └── server.js /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 CodAre 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api-sistem", 3 | "version": "0.0.1", 4 | "description": "api-sistem", 5 | "main": "server.js", 6 | "scripts": { 7 | "start": "node server.js" 8 | }, 9 | "dependencies": { 10 | "express": "^4.17.1", 11 | "random-text-faces": "^1.0.9" 12 | }, 13 | "engines": { 14 | "node": "12.x" 15 | }, 16 | "repository": { 17 | "url": "https://github.com/CodAre-Development/express-api-ornek" 18 | }, 19 | "license": "MIT", 20 | "keywords": [ 21 | "node", 22 | "glitch", 23 | "express", 24 | "Furtsy", 25 | "text-face" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const http = require('http'); 4 | app.use(express.static('public')); 5 | app.listen(8000) 6 | var logger = function (req, res, next) { 7 | var tarih = new Date(); 8 | var formatliTarih = tarih.getDate() + "." + (tarih.getMonth() + 1) + "." + tarih.getFullYear(); 9 | formatliTarih += " " + tarih.getHours() + ":" + tarih.getMinutes(); 10 | console.log(formatliTarih + ':Yeni istek') 11 | next() 12 | }; 13 | app.use(logger); 14 | 15 | const randomTextFaces = require('random-text-faces'); 16 | app.get('/', (request, response) => { 17 | response.json({yüz: randomTextFaces.get()}) 18 | }) 19 | --------------------------------------------------------------------------------