Template for asp.net core webapi service - asp.net-boilerplate

Using the asp.net.boilerplate it appears I will always have to choose a front-end option. It is possible to use this purely for a standardized REST webapi service only?

Yes, it is possible to use ASP.NET Boilerplate templates purely for a Web API service.
For example, choose the ASP.NET Core + Angular template, which provides you with:
+-- angular/
| +-- ...
| +-- src/
| +-- ...
|
+-- aspnet-core/
+-- ...
+-- src/
+-- ...
And then just ignore the angular folder.

Related

"chrome --allow-file-access-from-files" only for one folder

I have this structure of bundled web app:
/dist
|
|- index.html
|- inline.js
|- main.js
|- polyfills.js
|- favicon.ico
|-assets
|
|-icons
|
|- add.svg
|- arrow-down.svg
|- start.svg
Due to various reasons I want to serve it via file:// protocol instead of hosting http server.
However, Chrome can't acces files that are located in /assets/ folder - all files that are in root (dist) folder work fine.
I found out that I can run chrome "--allow-file-access-from-files", however it's told to be dangerous, as it opens my whole file system to attacks.
Is there any way to use "--allow-file-access-from-files" flag only for specific folder? Something like:
$ chrome --allow-file-access-from-files ./assets/**
that would be a good feature to add on chrome I think
+1 from me

Test web page on localhost without changing source paths

I have a webpage running on a server. It loads some resources which are included with paths relative to the current root (e.g. /folder1/partial.html).
When trying to open the webpage locally for testing, I run into problems because my Windows C: drive is now considered the current root. How can I work around this without having to change all the include paths?
You can't.
However, you can change your paths to be relative to the file rather than the root. This way it won't matter if you open your page locally or on the server. For instance:
root
|
+-- partial.html
|
+-- some_folder
| |
| +-- another_folder
| |
| +-- some_file.html
If you wanted to reference partial.html inside some_file.html then it's relative path would be ../../partial.html.
In English, this is saying go up two folders and then look for the named file.
Using a simple web server such as python SimpleHTTPServer solves the problem.

Atom + Browser-sync not reloading

When I start the browser-sync in the local project folder (just html/css project) using the command:
browser-sync start --server --files "css/*.css"
This starts the website after the following output in the terminal:
[BS] Access URLs:
-------------------------------------
Local: http://localhost:3000
External: http://192.168.1.13:3000
-------------------------------------
UI: http://localhost:3001
UI External: http://192.168.1.13:3001
-------------------------------------
[BS] Serving files from: ./
[BS] Watching files...
When I make changes to the CSS file in this folder nothing happens. When I manually reload the page via command-R the changes occur.
1) What can be causing this ?
EDIT: I have found a partial solution by type following command:
browser-sync start --server --files "*.html"
It now detects changes for index.html. Its not injecting updates from .css files, even when I type following command:
browser-sync start --server --files "*.html CSS/*.css"
My map structure is the following:
project X
+-- CSS
+-- normalize.css
+-- styles.css
+-- IMG
+-- logo.jpg
+-- pages
+-- index.html
2) How can I also make the program listen to changes made in the index.html file ? EDIT: SOLVED
Re #2:
Have you tried adding *.html to the files to be watched?
$ browser-sync start --server --files "css/*.css, *.html"
http://www.browsersync.io/docs/command-line/#files-example
So, I have found the solution for problem 1/2 was the following:
browser-sync start --server --files "*.html css/*.css"
All my folder names needed to be lowercase.

How can I serve only statics files on Google App Engine?

I wrote a game with HTML5. Locally, it only works if I run:
python -m SimpleHTTPServer
And then I open localhost:8000. So, just a bunch of .html and .js files won't work. I want to put my game online and because of this Github (Pages) is out of question, because it won't work.
This is the part of the code I need a server for (I do realize that localhost:8000/res/ won't work on App Engine, I'll need to change the address):
var mapFile = new XMLHttpRequest();
var self = this;
mapFile.open("GET", "http://localhost:8000/res/map" + mapNumber.toString() + ".txt", true);
mapFile.onreadystatechange = function() {
if (mapFile.readyState === 4) {
if (mapFile.status === 200) {
self.lines = mapFile.responseText.split("\n");
self.loadTilesFromLines();
}
}
};
mapFile.send(null);
So, I heard that Google App Engine would work, it supports Python and is very popular. Now, I don't need anything like what they have in their documentation (which is pretty well-written):
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, webapp2 World!')
app = webapp2.WSGIApplication([('/', MainPage)],
debug=True)
All I need is a SimpleHTTPServer that allows me to open my index.html on my-app.appspot.com.
I did try the example and got it up and running, but I can't force my browser to open index.html or src/ or even res/.
So, I am not even sure if Google App Engine supports what I'm trying to achieve here. The documentation just focus on building applications that use Python and all I needed with Python was a SimpleHTTPServer, which I don't think I need with App Engine.
Yes it is very doable on what you're trying to achieve here. Since you just want to serve static files it is very simple and you don't need to include any Python code.
Let's assume that you have this following structure:
└── my-game
├── app.yaml
└── static
├── index.html
├── js
│   └── script.js
└── res
└── map.txt
This app.yaml should look like this:
application: my-app
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /
static_files: static/index.html
upload: static/index.html
- url: /
static_dir: static/
After you're going to install the Google App Engine SDK (if you didn't do that already), you will be able to run the dev_appserver.py command from your terminal. If you have the above structure try to run it using the following:
$ dev_appserver.py /path/to/my-game
If everything went smoothly you'll be able to see your index.html on http://localhost:8080, the map.txt on http://localhost:8080/res/map.txt and you should be able to figure out the rest.
Note that you could still run your application using the python -m SimpleHTTPServer from within the static directory and test it on localhost:8000.

How to configure scm in flat multi-module projects in maven?

I am working with the following project structure
parent
+-- pom.xml (parent and reactor)
module-1
+-- pom.xml
module-...
+-- pom.xml
I would like to be able to do a mvn release:prepare on the parent project and have the resulting war as well as a consistent tag structure in svn.
Right now everything seems to work fine except the tagging of the modules, that is, a mvn release:prepare will tag the parent project but none of the child projects. I have already found and tried the switch commitByProject in the configuration of the parent-pom. I have entered and removed scm configurations in the moduel-poms, I have tried configuring the release-plugin in the module-poms all to no avail. The release-step never asks me for a tagname for any of the modules and consequently does not create a tag later on in the project.
How do I configure parent and module such that a mvn release:prepare will tag the modules?
I would suggest to reorganize the structure to fit Maven's best practice like the following:
root (pom.xml; parent)
+-- module-1 (pom.xml)
+-- module-2 (pom.xml)
+-- module-...
This will make your life easier with Maven and also in doing a release via mvn release:prepare etc.
I assume you have in VCS the following folder structure:
root
+-- parent (pom.xml)
+-- module-1 (pom.xml)
+-- module-2 (pom.xml)
+-- module-...
root is the folder which is checkedout from version control (trunk in SVN; or master git).
If you have given the correct relative path to the parent in the given modules everything should work without any problem....Configuring the scm part in parent.
After further, countless hours of searching I no longer assume, it is possible to tag each module independent from the others using the maven release plugin.
I have found (and lost) an explicit comment, that this is not possible with the release plugin and there are further hints, for example, that the release plugin only accepts exactly one scm tag in non-interactive mode.
As I'm a Java developer, not a maven developer I refuse to change my package structure and thus am stuck with doing the tagging by hand.