Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // pastebin, 31.3.2022
- const express = require('express')
- const app = express()
- // määritetään portiksi 3000
- app.set('PORT', process.env.PORT || 3000)
- // mitä tehdään kun tähän sivuun navigoidaan nettiselaimella
- // tässä tapauksessa palautetaan message-JSON
- app.get('/', (req, res) => {
- res.status(200).send({
- message: 'How do I deploy my code to Heroku using GitLab CI/CD?',
- })
- })
- // käynnistetään nodejs-serveri
- app.listen(app.get('PORT'), () =>
- console.log(`Server running on port ${app.get('PORT')}`),
- )
- module.exports = app;
- package.json:
- {
- "name": "heroku-gitlab-omaprojekti",
- "version": "1.0.0",
- "description": "",
- "main": "index.js",
- "engines": {
- "node": "16.14.2",
- "npm": "8.5.0"
- },
- "scripts": {
- "start": "node index.js",
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/OMAPROJEKTIOSOITE"
- },
- "author": "Tuomas Valtanen",
- "license": "ISC",
- "bugs": {
- "url": "https://gitlab.com/OMAPROJEKTI/issues"
- },
- "homepage": "https://gitlab.com/tuomasvaltanenLUAS/OMAPROJEKTI#readme",
- "dependencies": {
- "express": "^4.17.3"
- }
- }
- // jos tarvitsee tehdä master branch komentoriviltä, sen voi tehdä näin:
- git checkout -b staging
- git checkout -b master
- git add .
- git commit -a
- " anna commit-viesti siihen editoriin mikä tulee seille"
- git push --set-upstream origin master
- C# :
- public class EventShow
- {
- /*
- Nimi (String)
- • Osoite (String)
- • Päivämäärä (String tai Date)
- • Kategoria (tekstiä, String)
- */
- public string EventName { get; set; }
- public string EventAddress { get; set; }
- public string EventDate { get; set; }
- public string EventCategory { get; set; }
- public EventShow()
- {
- EventName = "N/A";
- EventAddress = "N/A";
- EventDate = "N/A";
- EventCategory = "N/A";
- }
- }
- public class EventShowViewModel
- {
- private ObservableCollection<EventShow> events = new ObservableCollection<EventShow>();
- // tehdään myös property ylläolevasta muuttujasta
- public ObservableCollection<EventShow> Events { get { return this.events; } }
- public EventShowViewModel()
- {
- // lisätään yksi testidata listaan
- // voi lisätä enemmänkin
- this.events.Add(new EventShow()
- {
- EventName = "Testitapahtuma",
- EventAddress = "Testikuja 12",
- EventDate = "31.3.2022",
- EventCategory = "Koulutus"
- });
- }
- }
- try
- {
- float val1 = float.Parse("123.4");
- float val2 = float.Parse("0.0");
- float sum = val1 / val2;
- // float palauttaa Infinityn nollalla jakaessa
- if (float.IsInfinity(sum))
- {
- // pakotetaan DivideByZeroException()
- throw new DivideByZeroException();
- }
- // asetetaan sum value esim. XAMLiin
- // jos yllä oleva if-lause toteutui, tämä skipataan
- }
- catch (Exception ex)
- {
- if (ex is DivideByZeroException)
- {
- Debug.WriteLine("Ei saa jakaa nollalla!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement