@dev_lak JWT API ekata setkrala thiyenne. token eka em enawa . token eka decrypt kranna ona web site eken neda
Best posts made by Nisal Vimukthi
-
RE: Laravel Web site ekak Node.js Api ekak ekka connect kranne kohomada ?
-
RE: Msql Time different with local Time
Windows license key ekak use krala active krada ? ehema nam e license key eka aithi rate timezone wetenne
-
Laravel Web site ekak Node.js Api ekak ekka connect kranne kohomada ?
Laravel walin develop karapu web site ekak Node.js Api ekata connect kranna ona CURD operations karanna and authentication ekata. denata website ekata local mysql db ekata thama connect krala thiyenne . mata denaganna ona website eken http requests yavanne komada kiyala API ekata authentications ekka sessions ema weda karanna ?
-
Flutter app eken http post req ekak send karahama 500 error ekak enavane . postman eken API eka test kra hodata weda okkoma methoda
(
mage node.js api eka post man eken test karama hodata weda get, post , put request okkoma check kra. mongoose ekka ynne . post eken data idan insert wenawa kisi aulak nethuva postman eken test karaddi. but flutter android app ekaen api eka haraha data send kranna hedhuvama 500 internal error ekak enavane. fix kranne komada meka ?
http.dart file
import 'dart:convert'; import 'package:http/http.dart' as http; class RequestResult { bool ok; dynamic data; RequestResult(this.ok, this.data); } const PROTOCOL = 'http'; const DOMAIN = "192.168.*.**:3000"; //const ROUTE = "users/signup"; Future<RequestResult> http_post(String route, [dynamic data]) async { var url = "$PROTOCOL://$DOMAIN/$route"; var dataStr = jsonEncode(data); var result = await http.post(url, body: dataStr, headers:{"Content_Type": "application/json"}); return RequestResult(true, jsonDecode(result.body)); }
signup.dart file
class _SignUpState extends State<SignUp> { TextEditingController userNameController = TextEditingController(); TextEditingController emailController = TextEditingController(); TextEditingController phoneNumberController = TextEditingController(); TextEditingController nicController = TextEditingController(); TextEditingController passwordController = TextEditingController(); String response = ""; createUser() async { var result = await http_post("users/signup", { "userName": userNameController.text, "email": emailController.text, "phoneNumber": phoneNumberController.text, "nic": nicController.text, "password": passwordController.text, }); if(result.ok) { setState(() { response = result.data['status']; }); } }
Api app.js code headers middlewaes
mongoose.Promise = global.Promise; //middlewares app.use(morgan('dev')); app.use(bodyParser.urlencoded({extended: false})); app.use(bodyParser.json()); //set access to all connect to this api app.use((req, res, next) => { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); res.header('Access-Control-Allow-Headers', 'X-Requested-With, Origin, Content-Type, Accept, Authorization'); next(); }); app.use('/users', usersRoutes); app.use('/posts', postsRoutes); app.use((req, res, next) =>{ const error = new error('Not found'); error.status= 404; next(error); }) app.use((error, req, res, next) => { res.status(error.status || 500); res.json({ error: { message: error.message } }); }); module.exports = app;
-
RE: Laravel Web site ekak Node.js Api ekak ekka connect kranne kohomada ?
@dev_lak vue js walin kranna hoda vidiyak thiyenawada ? wediyama lesi mokak wageda
-
RE: Flutter app eken http post req ekak send karahama 500 error ekak enavane . postman eken API eka test kra hodata weda okkoma methoda
@dev_lak eka komada balanne postman eken check kraddiapieka wedane
-
RE: Laravel Web site ekak Node.js Api ekak ekka connect kranne kohomada ?
ah mn den mySQL db ekka auth krala thibbata aulak ne neda eka ain karala vue ekka karanna puluvan neda
-
Mage laravel website eka MongoDb cluster ekka connect kranna giyama me error eka enava. meka fix karanne kohomada ?
![alt text](![0_1584632797802_erro.JPG](Uploading 100%) image url)
Mage laravel website eka MongoDb cluster ekka connect kranna giyama me error eka enava.
laravel version eka 6 mage.code eka config my conf/database.php vala
'mongodb_conn' => [ 'driver' => 'mongodb', 'dsn'=>'mongodb+srv://myusername:[email protected]/test?retryWrites=true&w=majority', 'database' => 'mydbname', ],
.env eke code eka
APP_NAME=My_laravel_web APP_ENV=local APP_KEY=base64:jtvoXduyfwnIB6A5pCy8Cfa9bJYRvNgMKeRFdfiYYyc= APP_DEBUG=true APP_URL=http://localhost LOG_CHANNEL=stack DB_CONNECTION=mongodb_conn' DB_HOST=xxxx-shard-00-00-uggj0.mongodb.net DB_PORT=27017 DB_DATABASE=mydbname DB_USERNAME=myusername DB_PASSWORD=mypassword BROADCAST_DRIVER=log CACHE_DRIVER=file QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120 REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379
meka fix karanne kohomada
error message eka
php artisan serve InvalidArgumentException : Database [mongodb_conn'] not configured. at C:\xampp\htdocs\bloodDonation\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:152 148| // If the configuration doesn't exist, we'll throw an exception and bail. 149| $connections = $this->app['config']['database.connections']; 151| if (is_null($config = Arr::get($connections, $name))) { > 152| throw new InvalidArgumentException("Database [{$name}] not configured."); 153| } 154| 155| return (new ConfigurationUrlParser) 156| ->parseConfiguration($config); Exception trace: 1 Illuminate\Database\DatabaseManager::configuration("mongodb_conn'") C:\xampp\htdocs\bloodDonation\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:115 2 Illuminate\Database\DatabaseManager::makeConnection("mongodb_conn'") C:\xampp\htdocs\bloodDonation\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:86 Please use the argument -v to see more details.